Currently I'm working on a water scene node that incorporates depth information. Everything is fine so far but when I use clip planes in opengl I get the following:
In d3d the same scene looks like this:
I put a debug output of the reflection/refraction and depth rtt into the top.
As you can see the reflection rtt in opengl as well as the refraction rtt are different.
My code for creation the reflection map looks like this:
Code: Select all
void CWaterSceneNode::updateReflectionMap()
{
//get current camera
scene::ICameraSceneNode* currentCamera = SceneManager->getActiveCamera();
// get the video driver
video::IVideoDriver* videoDriver = SceneManager->getVideoDriver();
// render to reflection
videoDriver->setRenderTarget(ReflectionMap, true, true, video::SColor(0,0,0,0));
// set the FOV and far value
Camera->setNearValue(currentCamera->getNearValue());
Camera->setFarValue(currentCamera->getFarValue());
Camera->setFOV(currentCamera->getFOV());
// set the position of the water camera
core::vector3df position = currentCamera->getAbsolutePosition();
position.Y = -position.Y + 2.0f*RelativeTranslation.Y;
Camera->setPosition(position);
// set the target of the water camera
core::vector3df target = currentCamera->getTarget();
target.Y = -target.Y+2.0f*RelativeTranslation.Y;
Camera->setTarget(target);
// set the reflection camera as active camera
SceneManager->setActiveCamera(Camera);
// enable reflection clip plane
core::plane3d<f32> reflectionClipPlane(
0, RelativeTranslation.Y-ReflectionClipPlaneOffet, 0,
0, 1, 0);
videoDriver->setClipPlane(0, reflectionClipPlane, true);
// draw the scene
SceneManager->drawAll();
// disable reflection clip plane
videoDriver->enableClipPlane(0, false);
// reset active camera
SceneManager->setActiveCamera(currentCamera);
}
My question is now: Do clipplanes work different in opengl and d3d or what could be the reason fot the difference.
Thanks in advance for your help...