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

Christian Heine Hellhound at binary-revolution.org
Sun Oct 7 01:38:42 PDT 2007

Hi Mihai,

>A short comment before looking at any of the code ( can't open the zip ).

I've checked the zip File, it's working for me (i've open it with 7zip)
, independent
of using windows or Linux as OS. If you got anymore trouble with this
file, i
could send the zip-file to your private mail address separately, if you

The coords for the textureUnits are hard coded in the OSGObjects class,
where i
define the quad and the hud objects. These are standard coords and there
be no problems with them:

osg::ref_ptr<osg::Vec2Array> texCoords = new osg::Vec2Array();

Thanks for the hint with the projection matrix. This could be the
problem, i will
check it later, if i got solved the main problem with the wrong camera view
definitions, which i could solve until yet...

I think this issue is the main problem i've. I don't understand why i
got invalid
RTT object's if i use the ABSOLUTE camera view definitions.

Best regards,

Mihai Radu wrote:
> Hi Christian,
> A short comment before looking at any of the code ( can't open the zip ).
> >From the snippets you posted, it looks to me like the texture
> coordinates used for textureUnit 0 are not correct.
> If they are set with the geometry ( per vertex ), then the first part
> should work well, if they are either object-relative or eye-relative
> with a TexGen to calculate them, that requires some calculations in the
> vertex shader ( that are done automatically by the fixed-function
> pipeline ).
> Looking even more closely, I can see you are rendering to a single quad
> ( z values are 0 ), and the last line scales everything in the [0.0,1.0]
> range, from the usual [-1.0,1.0], something that is done with projective
> texturing ( see osgshadow example for the way _texGen is being scaled ).
> I think the only reason your second snippet is working is because you
> are using an identity matrix for the camera, if you were using anything
> else, your results would probably be off.
> summary: check the texture coordinates for the pass you are referring to :)
> Cheers
> Mihai
> Christian Heine wrote:
>> Hello,
>> 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
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

More information about the osg-users mailing list