Skip to main content
gamedev.net
🔒 Locked 🎮 Unity

Fully Dynamic Cube Mapping

Started by programci_84 0 replies 900+ views
Original Post
programci_84
programci_84
Hi guys! First, execuse me if you cannot understand because of my bad English. I'm working on dynamic cube mapping. I've looked at DX SDK's HDRCubeMap sample and updated its code to have ability to move the reflective model; but I saw that when I moved it, reflection didn't change. Now I'm using a technique. When I accessed cubemap's face and before start rendering to this surface, I move the objects which will be rendered by changing their World Matrices' m41, m42 and m43 elements.
Vector3 Pos = ReflectiveObjectWorldPosition;

For each object which will be rendered to cubemap's active surface
{
object.WorldMatrix._41 -= Pos.x;
object.WorldMatrix._42 -= Pos.y;
object.WorldMatrix._43 -= Pos.z;

render this object to active surface;
}
next object
And I got (I think)nice results: Scene1 Scene2 Scene3 Scene4 You see that the reflection on the skull mesh is fully dynamic but I think that my technique isn't an absolute technique. Because, I couldn't succeed to find right "moving" value. I mean, the value I used above gave me some nice results on "curved" surfaces but didn't on "flat surfaces". I've read a topic here says that Inverse (I'm not sure, maybe Transpose) of View Matrix could be used. But I couldn't understand it. Are there anyone knows this or any other method(s)? Best Regards, Rohat.
There's no "hard", and "the impossible" takes just a little time.
MJP
MJP
I haven't looked at that sample in a long time, but I believe that when it would create a view matrix for each side of the cubemap it would use <0,0,0> as the position when call D3DXMatrixLookAtLH. Instead of <0,0,0>, you just need to pass the position of the object that has the reflections. Then the objects being rendered onto the reflections will be "automatically" moved into the right position relative to the reflective object by the view matrix.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.