Hi all
Here comes my follow up. As you can see in the code snipped above, the clipping
plane of the refraction camera is looking in the opposite direction. Since the
clipping is done on the graphics card, and the primitives are still in world
coordinates, the refraction clipping plane has to be multiplied with the
transposed camera matrix.
Code:
// this is what happens in cull:
osg::Matrixd l_ViewMatrix = l_MainCamera->getViewMatrix();
osg::Matrixd l_ProjMatrix = l_MainCamera->getProjectionMatrix();
osg::Vec4d l_PlaneNormalCoeff(0.0, 0.0, -1.0, -m_Height);
osg::Matrixd l_CameraMatrix = l_ViewMatrix * l_ProjMatrix;
osg::Matrixd l_InvCameraMatrix = osg::Matrixd::inverse(l_CameraMatrix);
double* l_MV = l_InvCameraMatrix.ptr();
osg::Matrixd l_InvCameraMatrixTransposed;
l_InvCameraMatrixTransposed.set(
l_MV[0], l_MV[4], l_MV[8], l_MV[12],
l_MV[1], l_MV[5], l_MV[9], l_MV[13],
l_MV[2], l_MV[5], l_MV[10], l_MV[14],
l_MV[3], l_MV[6], l_MV[11], l_MV[15]
);
l_PlaneNormalCoeff = l_InvCameraMatrixTransposed * l_PlaneNormalCoeff;
m_RefractionClipPlane->setClipPlane(l_PlaneNormalCoeff);
The problem I encounter is the following. All the stuff doesn't have any
effect. The fact of setting a new Clip Plane in the RefractionClipPlane object
doens't do anything.
So I end up having a clip plane for the reflection camera and a clip plane for
the refraction camera with both show into opposite directions . According to
the theory, this should work...
I read something about Positional State attribute and that there are issues
when setting multiple clipping planes. I don't get the point there, and maybe
need some more insight (say explanation). I thought by having two distinct
render cameras, they should be able to have their own clipping planes?
Regards
Daniel
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=56392#56392
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org