Game Development Reference
In-Depth Information
Figure 8-7. A grid rendered using thick lines. The rendered lines have a constant width regardless of the view point.
This creates an unaesthetic “thickness” at the edges of the shape, as well as small gaps between adjacent lines.
Writing a fragment shader that discards the inside of the rectangles, leaving only a frame for
display (see Figure 8-8b). The upside of this approach is that it is straightforward to implement
and that the rectangle model can be rendered with minimal modification (dividing each rectangle
into two triangles). The downside is that the fragment shader is only capable of discarding whole
pixels. If the underlying WebGL environment supports antialiasing through multisampling, as is
currently the case with Google Chrome, the discarded pixels would create unaesthetic, jagged
edges inside the holes.
Figure 8-8. (a) A grid rendered using a plain triangle mesh on a display with multi sampling. (b) A grid rendered using a
shader that calls discard .
Search WWH ::




Custom Search