Jump to content
  • Advertisement
Sign in to follow this  
sepul

Z Artifacts

This topic is 3691 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'm rendering the scene twice, Z-pass and normal pass. the problem is, I'm using some optimized method for rendering the z-pass, the data sends to GPU with position and worldMatrix stored in the vertex (float4 pos:POSITION, float4 mx:TEXCOORD0, float4 my:TECCOORD1, float4 mz:TEXCOORD2, float4 mt:TEXCOORD3), and the shader extracts the worldmatrix from the vertex and transforms it. the problem is that I got Z-artifacts after drawing the object in the normal mode (passing the WorldMatrix normally to the shader variables). is there anyway that I can eliminate this problem ? thanks

Share this post


Link to post
Share on other sites
Advertisement
Because of floating point properties ((a*b)*c) != a*(b*c) for example), your z-prepass and the following passes need to have an invariant position computed, else you're going to have cracks and other artifacts.

If you compute your final homogeneous position one way in the first pass, you shouldn't change it for performance reason in the second pass, because in this case consistency > performance.

See for example : multi pass depth invariance.

On console you have easy ways to specify an invariant position computation, but on PC this isn't entirely possible unfortunately so all you have left is tweaking of your shaders (they should ideally be identical at least up to the point where position is being output)..

LeGreg

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • 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!