=rk=
Resource contributor
- Messages
- 4,702
- Country

Z-fighting is the flashing seen in polygons as one changes distance in relation to them. This post is intended to describe the phenomenon so designers can understand and correct the condition. It's not intended to be technical or definitive as much is it should be illustrative. Feel free to augment or correct ideas expressed here. The conditions that produce a flashing area are the consequence of mathematical limitations expressed incrementally as part of the exact percentage of the distance involved. The condition is basically inevitable so it is best to establish provisions to minimize flashing.
Dynamic information can be represented in either one of two recognized ways, "analog" or "digital." Analog displays capture the essence of information as it changes, you see the entire field from full tank of gas to empty and the number of gallons left at half a tank matter much less than the number of miles since the last fill, which are invariably expressed in digital form. Digital displays indicate the exact value expressed within the limit of space and place; the time is 12:04, 12:04:32 if another place is added. There is no gray area allowed as with analog displays, a number is a number and if there are only two decimal places than that limits the display to steps with values that fall within those decimal places. Obviously about 99% of math is digital, including the math that calculates render priority. What happens is that the equations establishing the render priority have what turns out in this case to be a relatively limited number of decimal places.
To understand the scenario, lets assume the computer we are using was a really great deal and so the calculations it can perform are limited to one decimal place. In terms of distance it can recognize 1 meter, 1.5 meters, 2 meters, 2.5 meters, etc. Anything else gets rounded up or down, 2.2 meters is 2 meters, 2.4 meters is 2.5 meters..can you see where this is going? To create Z-flashing conditions in this computer's simulator, we will render two polygons that are parallel but slightly apart, let's say at .25 meters. Now in the simulator looking at those polygons from 5 meters away, what will the simulator render? The next closest polygon is 5.25 meters away, which the software will round to 5.5 meters, so it should render the planes more or less as expected, maybe with an exaggerated offset that we would have to get used to. Now let's move back .25 meters; both polygons will render at 5.5 meters! Oh no, the Z's will flash. You can see that as distance changes, the inevitable back and forth flashing occurs. Eventually the included distance between the polygons, expressed as a percentage of the total view distance either drops below the decimal place cut off, or grows to such a high value that the planes are never superimposed. In either case the flashing stops. a common solution is to offset the parallel polygons to a distance that is beyond the "gray area," or decimal place limit, an operation that also can make the closer plane look unnaturally distant from what it is intended to represent when viewed from nearby.
Dynamic information can be represented in either one of two recognized ways, "analog" or "digital." Analog displays capture the essence of information as it changes, you see the entire field from full tank of gas to empty and the number of gallons left at half a tank matter much less than the number of miles since the last fill, which are invariably expressed in digital form. Digital displays indicate the exact value expressed within the limit of space and place; the time is 12:04, 12:04:32 if another place is added. There is no gray area allowed as with analog displays, a number is a number and if there are only two decimal places than that limits the display to steps with values that fall within those decimal places. Obviously about 99% of math is digital, including the math that calculates render priority. What happens is that the equations establishing the render priority have what turns out in this case to be a relatively limited number of decimal places.
To understand the scenario, lets assume the computer we are using was a really great deal and so the calculations it can perform are limited to one decimal place. In terms of distance it can recognize 1 meter, 1.5 meters, 2 meters, 2.5 meters, etc. Anything else gets rounded up or down, 2.2 meters is 2 meters, 2.4 meters is 2.5 meters..can you see where this is going? To create Z-flashing conditions in this computer's simulator, we will render two polygons that are parallel but slightly apart, let's say at .25 meters. Now in the simulator looking at those polygons from 5 meters away, what will the simulator render? The next closest polygon is 5.25 meters away, which the software will round to 5.5 meters, so it should render the planes more or less as expected, maybe with an exaggerated offset that we would have to get used to. Now let's move back .25 meters; both polygons will render at 5.5 meters! Oh no, the Z's will flash. You can see that as distance changes, the inevitable back and forth flashing occurs. Eventually the included distance between the polygons, expressed as a percentage of the total view distance either drops below the decimal place cut off, or grows to such a high value that the planes are never superimposed. In either case the flashing stops. a common solution is to offset the parallel polygons to a distance that is beyond the "gray area," or decimal place limit, an operation that also can make the closer plane look unnaturally distant from what it is intended to represent when viewed from nearby.