Searc

Sunday 22 January 2012

Using a logarithmic z buffer

Well i have decided to enable the crack fixing still not perfect but it works, the only problem is with such a large object you get shimering due to zbuffer fighting, the way this is solved by most people is to use a logarithmic z buffer, the way to do this is to calculate the depth in the shader. It was actually very simple to do, just add a few lines of code and there we have it.

1:       const float Cc = 1.0; 
  
2:       const float Far = 1000000000.0; 
  
3:       output.Position.z = log(Cc*output.Position.z + 1) / log(Cc*Far + 1) * output.Position.w;   

I show how this works in the following screenshots.

without the logarithmic z buffer



with logarithmic z buffer


It has now brought to my attention a few other things i can see but for now this will do :).

No comments:

Post a Comment