Game Development Reference
In-Depth Information
alignment changes to face the camera. For world-oriented text, we can use the default be-
haviorofthedepthbuffer.Atthestartofthedepthtestthevalueofthedepthbufferissetto
the largest possible value, as each polygon is rendered, it is tested against the correspond-
ing value for each pixel in the depth buffer, if the depth value of our text quad is smaller
than the value stored in the depth buffer, then this depth value is stored in the depth buffer,
this will treat our world-oriented text as part of the scene and it will become occluded by
geometry (such as players, and other game objects) as they are drawn.
As it is this method is likely to have some performance implications. Every time some text
is rendered we are switching render targets, drawing, resetting the render target then draw-
ing again. While it doesn't sound like much, these context changes may have a significant
performance cost depending on the platform.
It would be best to batch all the text that is to be drawn in-world, render it all into a single
texture and then use this texture to render the world-space quads, which we can also batch
into a single vertex/index buffer. This gives us the ability to render some or all of the in-
world text in a single draw call.
Search WWH ::




Custom Search