[osg-users] Setting up a shadowDepthCamera

Werner Modenbach Werner.Modenbach at texion.eu
Fri Sep 8 04:26:53 PDT 2017


Hi all!

I'm still working on my shadow technique for OpenGL 3 shaders.
I only partially manage setting the matrix for the light camera creating 
the shadowMap.

What I do:
     osg::Vec3lightPositionVS=mainCamera->getViewMatrix()*lightPosition;

osg::Vec3eye;

osg::Vec3center;

osg::Vec3up;

mainCamera->getViewMatrixAsLookAt(eye,center,up,view->getDistance());

shadowDepthCamera->setViewMatrixAsLookAt(center,center+lightPositionVS,up);

That works quite fine except it doesn't honor the manipulations which are
usually done by the model matrix (scaling / translation).
So I guess I should do something like that:
         osg::Vec3lightPositionVS=???->getModelMatrix() * mainCamera->getViewMatrix()*lightPosition;

I have references to the view and to the mainCamera.
I found out that the model matrix is held by the cameraManipulator.
Unfortunately I couldn't find and way to get the manipulator from the references I have.
Any other things I have to care about?

Or is there any other approach in setting up the shadowDepthCamera?

Any idea?

Thanks

- Werner -

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20170908/726b9dea/attachment.htm>


More information about the osg-users mailing list