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.

Monday, August 2, 2010

SIGGRAPH Notes

I'd like to share some of my notes from SIGGRAPH. I promise this will be my last SIGGRAPH post, then I will return to directly book-related things.
  • Courses: Morgan McGuire organized an excellent course: Stylized Rendering in Games. There was lots of talk on rendering silhouettes, where, like a lot of things, "the devil is in the details." I liked how the Borderlands talk went into almost painful detail on using a Sobel filter for silhouette rendering. BTW, a Sobel filter is also useful for computing terrain normals.

    Beyond Programmable Shading was a hit as always. I go to this course ever year and it always has new content. In particular, Jonathan Ragan-Kelley gave a great talk on scheduling the graphics pipeline. It's rare to find good information on this kind of stuff. The course ended with a panel on programmable vs fixed function hardware. For me, the takeaway was fixed function hardware is fast and uses very little power so it will remain for algorithms that are unlikely to change (e.g. video decode, rasterization, etc.). My opinion from a developer's perspective is: fixed function is fine for things I have no interest in changing but I want everything else to be programmable.
  • Panels: There was a really unique panel called "CS 292: The Lost Lecture." In which, Richard Chuang, co-founder of PDI, and Ed Catmull, president of Pixar and Disney Animation Studios, reflected on a graphics course Ed Catmull and Jim Blinn taught at Berkley in 1980, which Richard Chuang attended. The panel included video clips from the course and several memoriable quotes (disclaimer: I tried to write these down word for word but no promises):

    • "It's the kind of thing where you understand it and it is still hard." - Ed Catmull on visible surfaces in 1980.
    • "It would be nice if this thing could do a little more. In fact, it would be good if it were programmable." - Ed Catmull on the GPU in 1980.
    • "Because we didn't know any better, we were on the forefront of a brand new field." - Richard Chuang.
    • "The result of teaching these two classes created our biggest competitor" - Ed Catmull speaking about PDI/Dreamworks.
    • "If we don't have any major surprises then we are becoming too conservative." - Ed Catmull.

    When asked during the panel, Ed Catmull did not object to having the videos of his 1980 course released. It would be great to have such historic videos available.
  • Books: One of my favorite things about SIGGRAPH is all the new books. I'm happy to see the fifth edition of the OpenGL SuperBible is out, and it only covers the core profile! It's about time we got a book covering just "modern" OpenGL. Another book that looks interesting is Writing for Computer Science. Its been out since 2004 so I'm surprised that I haven't ran into it before. I probably should have read it before starting on my own book!
  • Posters: Stefan Elsen had an interesting poster on real-time procedural generation of planets using fractals: "WorldSeed: Fractal Worlds in Realtime." His website has much more information including an impressive video. Our poster, GPU Ray Casting of Virtual Globes, was also well received. I actually ran out of hard copies of the abstract!
  • OpenGL: Those notes are in my previous post.
There was a whole lot more to see at SIGGRAPH but these were the highlights for me. Now that all the SIGGRAPH fun is behind us, I need to lock myself in my house and finish this manuscript!