Game Development Reference
In-Depth Information
Figure 3.5. (a) Vector data drawn without the depth plane result in artifacts. (b) With
the depth plane.
actually under the true globe, which itself is approximated by triangles. With
standard depth testing, parts of the vector data will fail the depth test and z-fight
with the globe as shown in Figure 3.5.
We solve this using a method that is well-suited for JavaScript and WebGL; it
uses very little CPU and does not rely on being able to write gl_FragDepth . 3 The
key observation is that objects on or above the backside of the globe should fail
the depth test, while objects on—but actually under—the front side of the globe
should pass. We achieve this by rendering a depth plane , shown in Figure 3.6(a),
Figure 3.6. (a) The depth plane intersects the globe at the horizon. (b) A ray is sent
through each fragment in the plane to determine which fragments intersect the globe,
and, therefore, need to write depth.
3 We expect an extension for writing depth in the future.
Search Nedrilad ::

Custom Search