|
I’ve been trying to modify the osgdepthshadow example
to make use of two separate light sources, but I cannot get the effects of the
two lights to blend in a union. If I understand the example correctly, a TexGen
is used create a texture on the shadowed object where each pixel is assigned a
1 if it is in the light’s line of sight and 0 if it is not. Would it be
possible to have the bitmap be the union of two different maps created by two
different projections? I do not need areas that are hit by two lights to be
lit any differently than just a single. A simple 0 for not hit by either and 1
for hit by at least one light is enough. _cameraNode->setReferenceFrame(osg::CameraNode::ABSOLUTE_RF); _cameraNode->setProjectionMatrixAsFrustum(-right,right,-top,top,znear,zfar); _cameraNode->setViewMatrixAsLookAt(position,bs.center(),osg::Vec3(0.0f,1.0f,0.0f)); // compute the matrix which takes a vertex from local coords into // will use this later to specify osg::TexGen.. osg::Matrix MVPT =
_cameraNode->getViewMatrix() * _cameraNode->getProjectionMatrix() * osg::Matrix::translate(1.0,1.0,1.0)
* osg::Matrix::scale(0.5f,0.5f,0.5f);
_texgenNode->getTexGen()->setMode(osg::TexGen::EYE_LINEAR); _texgenNode->getTexGen()->setPlanesFromMatrix(MVPT); // Apply the effect from the
second viewpoint (position2) _cameraNode->setViewMatrixAsLookAt(position2,bs.center(),osg::Vec3(0.0f,1.0f,0.0f)); // compute the matrix which takes a vertex from local coords into // will use this later to specify osg::TexGen.. MVPT =
_cameraNode->getViewMatrix() * _cameraNode->getProjectionMatrix()
* osg::Matrix::translate(1.0,1.0,1.0)
* osg::Matrix::scale(0.5f,0.5f,0.5f); // This overwrites the effects
from the previous setPlanesFromMatrix, but I would like them to be a union. _texgenNode->getTexGen()->setPlanesFromMatrix(MVPT); I’ll admit that most of my attempts to achieve
this have been pretty ad hoc, since the technique is very new to me. Thanks for any help. Chase |
_______________________________________________ osg-users mailing list [email protected] http://openscenegraph.net/mailman/listinfo/osg-users http://www.openscenegraph.org/
