Not yet getting which step you are struggling with, I'm probably missing something. Is it about floor having 2 texture (it's own + reflection) and how to combine those?
The way to do such mirrors is something like:
1. Set the camera to the reflection vector of you real camera
Code: Select all
const core::vector3df camPos = activeCam->getPosition();
reflectionCamera->setPosition(core::vector3df(camPos.X, -camPos.Y, camPos.Z));
core::vector3df target = activeCam->getTarget() - camPos;
target.normalize(); // not sure if that one is really needed
target.Y *= -1.0f;
reflectionCamera->setTarget(reflectionCamera->getPosition() + target);
if(activeCam->getUpVector().Y > 0.0f)
reflectionCamera->setUpVector(core::vector3df(0.0f, 1.0f, 0.0f));
else
reflectionCamera->setUpVector(core::vector3df(0.0f, -1.0f, 0.0f));
2. Disable nodes you don't want in the reflection
3. Render reflection to render target texture
And maybe this is the step where you'll run into problems?
In my current project we use some fade-out there in shaders, like:
Code: Select all
float fadeFac = clamp(distToFloor / 25.0, 0.0, 1.0);
gl_FragColor = mix(gl_FragColor, vec4(1.0, 1.0, 1.0, 1.0), fadeFac);
Not sure how to replace this without shaders, my guess was that maybe using black or white fog could work? You have to figure out if there is some way to combine a fade-out with the real floor texture later.
4. Enable all your nodes again
5. Put the render target texture as second texture on your floor. Figure out which material/flags to use to combine those so you see floor and reflection. If you white out the fog earlier you can maybe just multiply them - there's some fixed function materials for that I think - the lightmap stuff should do it, thought it means reflection makes your floor darker, there's probably better options. I tend to use shaders for this step again, so would have to experiment myself how to do that with fixed function materials.
6. Render your real scene with original camera