Sign in to follow this  

Reflections and the depth-buffer problems

This topic is 4352 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

Hi there. An easy way to create a flat mirror is by setting four clip planes and using the D3DXMatrixReflect. But depending on the position of the camera/objects in the scene, the depth-buffer method could give us a big headache. :) A single mirror on a wall of a house (where the camera could be in front of and behind that wall) is enough to cause problems... I would like to hear your opinions about how do you proceed (using Direct3D) to avoid or minimize these depth-buffer problems in reflections? Thanks in advance

Share this post


Link to post
Share on other sites
Quote:
Original post by adriano_usp
I would like to hear your opinions about how do you proceed (using Direct3D) to avoid or minimize these depth-buffer problems in reflections?

What problems are you actually having with the depth-buffer? You could try the common solutions:

(a) Increase the precision of the depth buffer

(b) Decrease the ratio of the near/far plane in the perspective matrix

Maybe a more in-depth description of the problems you are experiencing would help a bit.

Share this post


Link to post
Share on other sites
Thanks for replying, Dustin.

It is not a depth buffer precision problem. I will explain:

The reflection matrix "places" the objects so that they are rendered behind the mirror (inside the space defined by the clip planes).
The problem appears when there are other objects behind the mirror and they are closer to the camera's eye than the reflected objects. In this case, the reflected objects are discarded by the z-buffer method. To avoid this, we usually clear the z-buffer, but this could cause problem when the camera is behind the mirror (I need show an example for a better understanding).

If there are many objects in the house and the walls belong to the same mesh, the selection of the rendering groups (to make the mirror work correctly) is very annoying.

[Edited by - adriano_usp on January 11, 2006 6:09:32 PM]

Share this post


Link to post
Share on other sites

This topic is 4352 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this