PDA

View Full Version : Rendering artifacts (Buffer fighting?)



bcthund
03-05-2011, 12:43 AM
This issue has cropped up recently and I can't seem to track down why. It didn't do this before, sometime between starting on my shadows and finishing them this started happening. If I turn off the entire shadow system it still occurs though.

It gets worse the farther away I get, but as seen in the picture it happens even when very close as well.

http://www.bcthund.net/image/artifacts.png

Any ideas on what could be causing this to happen?? Sometimes the object in the picture disappears almost entirely.

Aleksandar
03-05-2011, 01:54 AM
It looks like you have a problem with the precision. Probably your object is too small compared to the distance to the origin. Move the object to the coordinate system origin and if object renders correctly that's it!
Also, move near and far clipping planes as close to the object as possible (this will diminish Z-fighting, if it causes the problem).

mhagain
03-05-2011, 04:50 AM
You might also be getting a 16-bit Z buffer. I've seen this happen before with certain hardware, where if you ask for 32-bits at startup, but 32-bits doesn't exist, it will only give you 16.

In general it's always safer to ask for a 24-bit Z buffer during startup.

bcthund
03-05-2011, 10:38 AM
I asked for a 16 bit z-buffer, switching to a 32 crashes. Using 24 bit doesn't seem to make a difference either.

Distance from the origin doesn't help either as I have the same map drawn 3 times each at a farther distance and each one does it. I moved the far plane in closer and had no effect.

Ahh, I changed the near plane and that seems to have fixed it. I was using 0.001f before to prevent clipping of objects too close, I must have accidentally made this value smaller than it should have been. Using 0.1f fixes the problem without causing clipping issues close to objects. Thanks for the help.