Hi J-S,

I am not sure whether its related or not. We once observed the case when osg 
uniforms (like osg_ViewMatrixInverse) were not  applied by graph nested 
cameras.  I don't recall what exactly was going there. We forced this apply 
by adding osg_ViewMatrixInverse to nested camera stateset.

    Uniform *uniform = cam->getOrCreateStateSet()->
        getOrCreateUniform("osg_ViewMatrixInverse",osg::Uniform::FLOAT_MAT4);

    uniform->set(osg::Matrix::inverse(  cam->getViewMatrix()  ));

I am not sure if this will affect slave cameras, though. As far as I 
remember they may behave correctly. But you can put a breakpoint in 
Uniform::apply and test if your osg_ViewMatrixInverse for slave cameras is 
being applied. Thats how we found our issue.

Cheers,
Wojtek Lewandowski


----- Original Message ----- 
From: "Jean-Sébastien Guay" <[EMAIL PROTECTED]>
To: "OpenSceneGraph Users" <[email protected]>
Sent: Wednesday, April 16, 2008 10:18 PM
Subject: Re: [osg-users] Getting the model matrix in the vertex shader.


> Hi Robert,
>
>> The main cameras view matrix could be added as an extra uniform, the
>> main cameras projection matrix too?
>
> That's what I'm doing, with the code I posted at the beginning of the
> thread, but it doesn't work, and I was wondering if I could get some
> help from someone who would have done the same thing in the past.
>
>> However. one will have to careful about all of this, if you need
>> something to be the same across all cameras then it really needs to be
>> in world coordinates, this way all cameras will get the same value for
>> it, so if you are getting problem perhaps it suggests that something
>> else needs to be tweaked along the way w.r.t the algorithm.  This is
>> in effect what I was talking about when suggest the use of position
>> lighting source rather than a directional one.
>
> Do this:
>
> osgdistortion --dome cow.osg
>
> Move the cow until it overlaps the junction of two slave cameras. You'll
> see that the geometry matches, but the reflection mapping has a break in
> it.
>
> This is caused by the fact that the reflection mapping uses texture
> coordinates generated in EYE_LINEAR mode, and each slave camera has a
> different view matrix offset, and so the texture coordinates don't match.
>
> The solution to that would be to use the master camera's view matrix to
> compute the texture coordinates instead of each slave's view matrix.
> That's what I'm trying to do.
>
> I can't switch to using a world-space algorithm. The algorithm is by
> definition eye-space (same with reflection mapping, it depends on the
> reflected view vector, therefore on the eye position).
>
> J-S
> -- 
> ______________________________________________________
> Jean-Sebastien Guay    [EMAIL PROTECTED]
>                                http://www.cm-labs.com/
>                         http://whitestar02.webhop.org/
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org 

_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to