PDA

View Full Version : Double identical texture rendering issue on same vertices .



stavbodik
02-23-2016, 03:10 AM
What can cause this behavior as shown on the screenshot attached ?
This is 2 meshes in exactly same axis (only x or z ) but as you can see i get an mix of the both textures .
Maybe its about wrong normal's calculation or light ?
The light in the scene is ambient and should fall the same on this meshes .

http://s13.postimg.org/jqv5und7b/shot_2016_02_23_11_56_57.png

Thanks !

GClements
02-23-2016, 12:58 PM
What can cause this behavior as shown on the screenshot attached ?
This is 2 meshes in exactly same axis (only x or z ) but as you can see i get an mix of the both textures .

That looks like depth-fighting, where you have two surfaces in the same plane, meaning that the rounding errors determines which surface has the lowest depth value for each fragment. glPolygonOffset() can be used to work around this issue by forcing one of the surfaces to be in front of the other.

In general, for two polygons to produce identical depth values for any given fragment, they must have identical vertices so that the calculation of depth values is identical in every regard. If there are any differences, the rounding errors introduced by floating-point or fixed-point arithmetic will result in non-identical depth values.