Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

LukeSkyRunner

z-fail and DX: too much problems

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

I implemented succeesfully the zpass shadow rendering. I''m able to do the shadow capping. But I got stuck on the render states changes for the zfail technique. My questions are: 1. Can the front cap (light cap) have its vertices order changed to get "back faced" and do not disturb the caster''s faces (zfighting, etc)? 1a. If not, what can I do to avoid this problem? A tried to set DEPTH_BIAS (called ZBIAS on DX 8.1) to 1.0 while rendering the shadow volume and 9999999.0 while rendering the scene but it seems to be not working. 2. Should I use D3DRS_STENCILZFAIL or D3DRS_STENCILFAIL? (for stecil depth testing and incrementing/decrementing) 3. Should I set or change any special render state for z-fail? something that I don''t need while using zpass? Or any render state set in zpass that MUST BE different on zfail. 3a. I''m not using the big square to dark the shadowed area, I''m using the same technique shown at "An Example of Shadow Rendering in Direct3D 9" (by Jack Hoxley, here: GameDev), so, while rendering the scene (after the shadow volume is rendered), does D3DRS_STENCILFUNC must be set to D3DCMP_GREATER? (The same used at zpass technique) Please, don''t send me papers URLs cos these weaks I''ve been reading lots and lots of good papers, my problem is based only at the implementation. Thanks and sorry if my english is not that good, hehe.

Share this post


Link to post
Share on other sites
Advertisement
these questions about shadow volumes were asked alot.I think you should see the previous threads about this article, But I would like to add somethings:
1)The problem of z fighting is famous with the capping polygons and was discussed alot.The depth bias doesn''t work with shadow volumes.nVidia says that you should displace the vertecies of the shadow volume in the direction of the normal.This solves the problem but the amount of displacement should be proportional to the distance from the camera due to the decrease of the z precision with distance which can procuce a wrong shadow volume on greate distances.another solution is to change the z test function to D3DCMP_LESS instead of D3DCMP_LESSEQUAL.This was said in a post before and I tested it and I found that it is working well for all distances.
2)use D3DRS_STENCILZFAIL .
3)No there''s no need for doing so.while rendering the transformed and lit quad the z test is not improtant.

Share this post


Link to post
Share on other sites
You probably need to set the z values so the details are not fully at the camera. You should adjust the near and far values. Usually most people have a near value that is too close to the camera. You should move it further away from the camera (actually as far away as you can tolerate) normally that would solve any z-fighting issue you might have.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!