Z-Buffer/polygon/rippling problem

Started by
1 comment, last by -indirectX- 18 years, 8 months ago
I've loaded in a 3ds file into my program with textures and animation and it looks good except for a strange problem where I get a kind of rippling effect in places. I thought it might be that there are two polygons overlapping and so both are being rendered simultaneously. I am using directX to automatically control z-buffering (in RenderState). Has anyone seen this before/know the solution to it? Here is a screen shot of the problem. It's a little hard to see but basically there is overlapping. All the best, Hugh
--------------------------------www.hughosborne.co.uk[email=hugh.osborne@googlemail.com]hugh.osborne@googlemail.com[/email]
Advertisement
That wouldn't happen to be a model from Deus Ex would it? [wink]

Anyway, it looks like a classic case of Z-Precision issues... there can be a few causes for this as well as solutions [smile]

Firstly you want to check your projection matrix - particularly the "near" value. Ideally you want a near/far combination that accurately encloses the model you are rendering - that way the Z-Buffer values will be distributed over a range that is *actually* useful to you [smile]

Also, values for zNear that are less than 1.0f can cause numerical instabilities in the projection matrix. If yours breaks this rule, set it to 1.0 or above.

Another thing to check is the scaling of your geometry - if you're shrinking your geometry by a large factor you might be getting numerical instabilities where parts of the geometry and generating the same Z value and thus appear to be overlapping.

You could, as an easy solution, try increasing the depth buffer precision - D3DFMT_D16 is the usual value, but you can have (if your hardware supports it) D3DFMT_D24X8 and D3DFMT_D32 - offering 24 and 32 bits of depth precision respectively. If this solves your problem great, but it's not necessarily a good permanent solution because your program may not always be running on hardware that supports high resolution depth buffers [smile]

hth
Jack

<hr align="left" width="25%" />
Jack Hoxley <small>[</small><small> Forum FAQ | Revised FAQ | MVP Profile | Developer Journal ]</small>

Hi there, Excellent advice jollyjeffers! It was the near clipping plane that was the problem - it was set to 0.1 instead of 1.0. Now everything looks fantastic!
Thanks very much and yes, it is a deus ex model, been having fun today importing loads of different ones. This is my favourite tho!

Thanks again,

Hugh
--------------------------------www.hughosborne.co.uk[email=hugh.osborne@googlemail.com]hugh.osborne@googlemail.com[/email]

This topic is closed to new replies.

Advertisement