Reflections and the depth-buffer problems

Started by
1 comment, last by adriano_usp 18 years, 3 months ago
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
Advertisement
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.
Dustin Franklin ( circlesoft :: KBase :: Mystic GD :: ApolloNL )
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]

This topic is closed to new replies.

Advertisement