[osg-users] Several RTT camera/shader issue(s) on multipass shading

Christian Heine Hellhound at binary-revolution.org
Wed Oct 3 05:16:22 PDT 2007


Hello,

actually i working on a multipass shading mechanism for our osg based
engine.
I got the multipass mechanism working, but there is still an issue with
the camera
and the shader calls. Hope somebody could push me in the right direction
to solve
this problem... I've attached the complete test code, which is working
with  osg  1.2.

1st issue (RTT Camera):
In the OSGRenderToTexture class i've defined a camera for each rtt. This
camera is relative and got only worked with the following view params:

camera->setProjectionMatrix(osg::Matrixd::scale(1.0f,1.0f,1.0f));
camera->setReferenceFrame(osg::Transform::RELATIVE_RF);
camera->setViewMatrix(osg::Matrixd::rotate(osg::inDegrees(0.0f),0.0f,1.0f,0.0f));

With this parameters all works fine and i got the RTT's of each Pass
(actually 3) ,
but the motionBlur is not effected. (See working screenshot, where the
red RTT
shows the result (effecting Shader 2), and the green RTT the result of
Shader 3
(first is for Dot3 rendered to the object).

I would use If i use the following parameters, nothing is shown on the
RTT results
(See defect screenshot):

camera->setProjectionMatrix(osg::Matrix::ortho2D(0,1280,0,1024));
camera->setReferenceFrame(osg::Transform::ABSOLUTE_RF);
camera->setViewMatrix(osg::Matrix::identity());

I cant find any failure on the 2nd camera view definitions. Have i
overseen something?

2nd issue (Shader):
If i use in the vertex shader the values of the rendering pipeline with
the following
setups, the RTT result is shown like in the working screenshot. The blur
effect
of the second pass is not effected but the shader executed (set color to
red):

gl_Position = ftransform();
vTexCoord = gl_MultiTexCoord0;

If i use this simple code sniplet (used in RenderMonkey for Shadertest)
then the
RTT is moved to screen center and sized up where nothing is shown (See
defect_vertexShader
Screenshot):

 vec2 Position;
 Position.xy = sign(gl_Vertex.xy);

 gl_Position = vec4(Position.xy, 0.0, 1.0);
 vTexCoord = Position.xy *.5 + .5;

I couldn't be explain, why this simple snipplet occurs in such an
effect. There is
nothing special done ...

Thanks for any help,
best regards
Chris






-------------- next part --------------
A non-text attachment was scrubbed...
Name: multipassTest.zip
Type: application/zip
Size: 3860253 bytes
Desc: not available
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20071003/16ec84fc/attachment-0002.zip>


More information about the osg-users mailing list