Jump to content

  • Log In with Google      Sign In   
  • Create Account


furqantariq

Member Since 11 Jun 2012
Offline Last Active Jul 30 2012 11:03 AM

Topics I've Started

Understanding Depth Testing

13 July 2012 - 10:58 AM

I'm reading 'introduction to D3D10' by Frank Luna. I have problem in solving first exercise of ninth chapter 'stenciling', which is following

Modify the Mirror demo in the following way. First draw a wall with the following depth settings:


depthStencilDesc.DepthEnable = false;

depthStencilDesc.DepthWriteMask = D3D10_DEPTH_WRITE_MASK_ALL;

depthStencilDesc.DepthFunc = D3D10_COMPARISON_LESS;


Next, draw a box behind the wall with these depth settings:


depthStencilDesc.DepthEnable = true;

depthStencilDesc.DepthWriteMask = D3D10_DEPTH_WRITE_MASK_ALL;

depthStencilDesc.DepthFunc = D3D10_COMPARISON_LESS;


Does the wall occlude the box? Explain. What happens if you use the following to draw the wall instead?


depthStencilDesc.DepthEnable = true;
depthStencilDesc.DepthWriteMask = D3D10_DEPTH_WRITE_MASK_ALL;
depthStencilDesc.DepthFunc = D3D10_COMPARISON_LESS;


Note that this exercise does not use the stencil buffer, so that should be disabled.



I have modified correctly as mentioned but i am not getting expected result.


what i had expected was that In first case since Wall depthTest is false and it will not update depthBuffer, box will shown and

in second case box will be hide by wall because wall is closer to camera.

but in actual the in both cases wall is occluding the box. why is that?


(Please excuse my poor english)


PARTNERS