Strange Artifacts

Mar 13, 2014 at 7:27 PM
I'm experiencing some weird artifacts the further away from the origin my camera gets. I'm fairly certain this is caused by the reconstruct z buffer shader. I'm not at all sure how to sort this out, however.

Here's a few pictures of the issues. (Please ignore the silly placeholder assets.)

Image
Image

Any ideas?
Mar 13, 2014 at 8:02 PM
I think I've fixed it by fiddling with the constants in the line of shader code that reads :

output.depth = saturate(output.depth + 0.0001f * (1.002f - output.depth));

An explanation of the issue, if anyone knows about it, would be nice though.
Coordinator
Apr 22, 2014 at 12:45 AM
I completed missed this post. Sorry.

Luckily you find the problem. Let me try to explain the problem. The engine renders too times the same geometry. In the first pass (the G-Buffer) we have to pay the fill rate cost even for hidden objects (a far object that it is occluded by a near object) . But in the second pass we should not, because we already have a depth information. XNA does not allow us to use the hardware depth buffer (there is a reason why, but it is not good in this case) and therefore I have to use my linear depth buffer version. The problem is that the floating point values are not perfectly accurate and thus the calculated depth information and my linear depth buffer content does not match perfectly.

Just play with this values or ignore the optimization. It is up to you.

Again, sorry for the delay. Just ask me anything else you want to know.

José.
Apr 22, 2014 at 10:48 AM
Thank you for the explanation. How would I go about just ignoring the optimization?