• Advertisement
Sign in to follow this  

Stencil Buffer Wrong side Reflection

This topic is 4335 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey guys, I am doing programming from the book Introduction to DirectX9 Programming by Frank Luna and I am up to chapter about stencil buffering http://ti-x.net/images/stencilMirror.jpg if you look at that screenshot you will see that its not exactly drawing correctly its drawing the exact same thing on the oterside eventhough it should be drawing the "dark side" of the teapot. how can I remedy this, now I know i gotta do something to the light direction's matrix but the light isn't a global light its used in a local function.

Share this post


Link to post
Share on other sites
Advertisement
When drawing the reflected object, you'll need to reflect the light direction by the same reflection matrix you use for the object.

Hope this helps :).

Share this post


Link to post
Share on other sites

To make planar reflections easier, why no render the scene from the reflected point of view, instead of reflecting the whole scene + everything else ?

So, reflect your camera position + camera direction vectors by the mirroring plane and render your scene from this mirrored camera. No need to worry about lighting or triangle culling order. Only thing is that the final image will be horizontally flipped. If you are using a texture projection, the fixup is rather obvious.

Cheers

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement