scene_gap man page

scene_gap — Number controlling the scene z-sorting algorithm behaviour. Allegro game programming library.


#include <allegro.h>

extern float scene_gap;


This number (default value = 100.0) controls the behaviour of the z-sorting algorithm. When an edge is very close to another's polygon plane, there is an interval of uncertainty in which you cannot tell which object is visible (which z is smaller). This is due to cumulative numerical errors for edges that have undergone a lot of transformations and interpolations.

The default value means that if the 1/z values (in projected space) differ by only 1/100 (one percent), they are considered to be equal and the x-slopes of the planes are used to find out which plane is getting closer when we move to the right.

Larger values means narrower margins, and increasing the chance of missing true adjacent edges/planes. Smaller values means larger margins, and increasing the chance of mistaking close polygons for adjacent ones. The value of 100 is close to the optimum. However, the optimum shifts slightly with resolution, and may be application-dependent. It is here  for you to fine-tune.

See Also

create_scene(3), clear_scene(3), destroy_scene(3), render_scene(3), scene_polygon3d(3)

Referenced By

clear_scene(3), create_scene(3), destroy_scene(3), render_scene(3).

version 4.4.2 Allegro manual