You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers. No questions about C++ programming or topics which are answered in the tutorials!
A-ha, gotcha!.
Well, seriouly, I got some z-fitghtin and I don't know hot to solved.
I have my terrain and over it a put a squad with a texture to make the tank track print.
But it seems sometimes that the z-distance is not well calculate and the terrain sometimes occlude the print.
What are the technics to solve this kind of fighting?
If you make sure your tank treads are draw after your terrain, you could disable the z compare on the material. However this could easily cause issues with tank treads on the back of a hill side.
Your best bet is to likely add some epsilon to the positions of the geometry for the treads so that the floating point inaccuracy isn't significant enough to give you z compare "fights".
arras wrote:Playing with camera near and far plane can help.
What values do you sugests?
I actualy using 0.01f for near value, and 10000 for far. My scale is 5 unitis 1 meter.
Your best bet is to likely add some epsilon to the positions of the geometry for the treads so that the floating point inaccuracy isn't significant enough to give you z compare "fights".
I don't understand quite well what do you recommed to do.
Do you mean like separating more the squad from the terrain?
if so, already is quite separted them (but not su much to view floating over the terrain).
z_buffer_value = (1<<N) * ( a + b / z )
Where:
N = number of bits of Z precision
a = zFar / ( zFar - zNear )
b = zFar * zNear / ( zNear - zFar )
z = distance from the eye to the object
...and z_buffer_value is an integer.