Jump to content

  • Log In with Google      Sign In   
  • Create Account

FREE SOFTWARE GIVEAWAY

We have 4 x Pro Licences (valued at $59 each) for 2d modular animation software Spriter to give away in this Thursday's GDNet Direct email newsletter.


Read more in this forum topic or make sure you're signed up (from the right-hand sidebar on the homepage) and read Thursday's newsletter to get in the running!


Understanding Depth Testing


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 furqantariq   Members   -  Reputation: 110

Like
0Likes
Like

Posted 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)


Edited by furqantariq, 13 July 2012 - 11:00 AM.


Sponsor:

#2 MJP   Moderators   -  Reputation: 11787

Like
0Likes
Like

Posted 13 July 2012 - 11:54 AM

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


This is incorrect. DepthEnable only controls whether depth testing is enabled, it doesn't affect depth writes. If you want to disable depth writes, you need to specify D3D10_DEPTH_WRITE_MASK_ZERO for DepthWriteMask.

#3 furqantariq   Members   -  Reputation: 110

Like
0Likes
Like

Posted 14 July 2012 - 02:00 AM

Now i got it. Thank you very much.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS