Sunday, August 22, 2010

Rendering Vector Data

I just finished writing our chapter on rendering vector data on a globe. Leave it to me to write 60 pages on something as simple as rendering polylines, polygons, and points! Of course, it is not quite as simple as it sounds. I'd like to share an overview of the content and screen shots of the example code, which you can download now: Chapter07VectorData in OpenGlobe.

Country polygons, state and
river polylines, and city points (billboards)
Country polygons and river polylines

This chapter begins with two short sections on sources of vector data and on avoiding z-fighting between vector data and the globe it is drawn on. The bulk of the chapter is then in these three sections:
  • Polylines
    • Layouts: strips, loops, and indexed lines.
    • Batching and static vertex buffers.
    • Rendering wide lines using a geometry shader [code].
    • Shaders for rendering outlined (two color) lines [code].
  • Polygons
    • Overview of raster techniques for polygon rendering.
    • A pipeline for geometry-based polygon rendering, including:
      • Triangulation: ear clipping [code], including a nifty way to ear clip polygons on an ellipsoid without projecting to a tangent plane [code].
      • Subdivision to make a polygon's triangulation better approximate the ellipsoid [code].
  • Billboards
    • Rendering billboards with a geometry shader [code].
    • Using and packing texture atlases [code].
    • Text rendering.
The example code also includes a partial ESRI Shapefile reader. The vector, raster, and icon data used is included in the example and can be downloaded from our data page.

Of course, the chapter contains much more than the above bullets but these are the highlights. Now, I'm off to write the chapter on moving much of this work (disk/network access, triangulation, texture atlas packing, GL resource creation) off the main thread. Since most the code for this is already done, I'm hoping this is a pretty easy chapter to write.

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.