Foliage Rendering in Pure

As I noted in my post on the first day at SIGGRAPH, I found the presentation from the guys at Black Rock Studio very interesting. Since the show, I’ve traded a few emails with Jeremy Moore who talked about the foliage rendering in Pure. Although the slides and course notes are not yet available, he provided me with some of the diagrams and screens from his talk to help my summary here. I think their method was very cool from a number of aspects.

  1. Their ground cover used a good blend of precomputation and runtime sorting to achieve good looking results.
  2. The foliage rendering for trees was an interesting technique that I think is applicable to both forward and deferred rendering.
  3. The tree rendering balanced the sort-order independent characteristics of alpha testing with the antialiasing of alpha blending.

Ground Cover

The ground cover system was independent of tree rendering. Here are the highlights of the system:

  • Density was painted by an artist into a 2D map. Values ranged from 0-15.
  • Each density value corresponded to a ground cover image within a texture atlas rather than a dynamic amount of geometry.
  • Ground cover was rendered within a fixed distance from the camera.
  • This distance, which I assume was square but easily could be radial, was divided into 400 tiles.
  • Each tile contained 256 camera aligned sprites using alpha blending for pleasing results. Experiments with the art staff rejected a alpha testing or alpha to coverage approach.
  • Within each tile, there were 32 chunks each containing 8 sprites spaced uniformly.
  • Drawing orders for chunks within a tile were precomputed from 16 different directions. See image below. IBs for each were built to avoid excessive runtime work.
  • At runtime, the system simply needed to sort the tiles for draw ordering and then select from the 16 precomputed orderings of the chunks.
Ground cover sorting in Pure. Image courtesy of Jeremy Moore at Black Rock Studio.

Ground cover sorting in Pure. Darker areas render later. Image courtesy of Jeremy Moore at Black Rock Studio.


  • There’s basically a hierarchical sorting algorithm here which is a twist that I hadn’t considerd although it’s obvious in hindsight.
  • Using precomputed results for the finest level of sorting is a great optimization.
  • Artist interface is simple. Paint ground cover into a texture.


  • The system was designed to minimize popping in Pure which is a fairly high speed game based on the footage I’ve seen. I wonder if the popping would be more noticeable with a slower camera. (I should probably rent the game at this point, but I am occasionally lazy.)
  • The precomputed sorting of chunks within a tile occurs based on a 2D vector to that tile. Since Pure is a racing game, that probably works well; the camera is generally at a low angle to the ground. With a free camera, you might need to map those vectors onto a hemisphere and hence use more than 16 precomputed directions.

Overall, there’s a great balance of “correct”‘ sorting for alpha blending with practical performance considerations here. Obviously, there’s going to be some amount of popping when you switch between the precomputed draw ordering for chunks. There’s no escaping that with a discretization like this. However, if the system minimizes that to the point where it’s not noticed by the player, it’s a success.


The tree rendering in Pure was another very well balanced system that I think could be applicable to objects other than trees. Based on their description, this approach is good any time some internal aliasing is acceptable but a good antialiasing at the edge of the alpha blended object is needed. With trees, some internal aliasing between leaves is acceptable, but you really want smooth alpha blending with no aliasing between the trees and the environment. I think this extends to any self-intersecting, dense, alpha blended object. Hair comes to mind as another good example.

Here’s the technique:

  1. Render the opaque objects.
  2. Clear the color buffer but not depth.
  3. Render the foliage alpha mask using alpha testing and depth testing but not depth writes.
    • There’s a separate pass here due to the alpha mask accumulation they use. Otherwise, we could store it during the color pass.
    • In the color channel, they store additively accumulated alpha.
    • In the alpha channel, they store the max alpha for a pixel.
    • Since both of these modes are commutative, there’s no need for depth writes and hence depth tests between the blended pixels.
    • See the image below. The top half is the accumulated alpha and the bottom is the max.
  4. Render the foliage color using alpha testing, depth testing, and depth writes to another color buffer.
  5. Composite the foliage color over the opaque scene using standard SRCALPHA/INVSRCALPHA blending.
    • The alpha value is computed as the average of the accumulated and max values.
    • This is not strictly correct, but the guys at Black Rock noted that it gives a good look with a pleasingly soft edge.
Alpha mask of foliage in Pure. Image courtesy of Jeremy Moore at Black Rock Studio.

Alpha mask of foliage in Pure. Image courtesy of Jeremy Moore at Black Rock Studio.


  • I don’t have to sort my trees at all! Hooray, alpha test and depth test!
  • The system still retains the soft, antialiased look of alpha blending at the boundary of trees rather than the highly aliased look of alpha testing.


  • Rendering the trees twice creates a lot of extra draw calls. Depending on the overhead of your system, that could be a concern.
  • Less of a concern and more just a crazy thought. I’m wondering what effects you could achieve using math other than a simple average in step 5.

Closing Summary:

Stuff like this always gets me excited because it’s immensely practical and current. Since it’s been used in production, I know I could turn around and use it tomorrow. In this case, there are some really good tricks, hacks, approximations, or whatever you want to call them for high performance sorting and order-independent alpha blending. They aren’t for everyone, but it’s good food for thought.

If anyone has questions, let me know. I took a lot of notes, so maybe I can answer. If we’re lucky, Jeremy might even come read and post a comment or two.

The alpha blending on the trees outside my office is stupendous. dba


5 Responses to “Foliage Rendering in Pure”

  1. Hi Dan.

    Thanks for putting these notes up. This was also my favorite talk from siggraph because of the amount of practical detail, and my need for better ground cover and trees. My notes are unfortunately high level, and I have more artifacts than I saw at the talk, and in Pure. Has Jeremy indicated when he’ll be able to finish the paper and get it posted? (I left my email.)


    • whatmakesyouthinkimnot Says:

      Jeremy only said that the full slides should be available on the ACM and Bungie sites shortly. He did not mention a date.

      If you’ve got questions or screens, feel free to ask them or send links. I took a pile of notes at the time plus correspondence with Jeremy. Maybe I can help.


  2. Hi guys,

    I have just written a chapter on the technique for the up-and-coming book: GPU Pro – Advanced Rendering (previously called ShaderX8) which should be out in December. In which you should find all the details needed to integrate the tech into your projects.

  3. Jeremy Moore Says:

    Hi Dan,

    That’s a really great summary of the talk. Thanks.

    The slides for all of this years Advances in Real-Time Rendering in 3D Graphics and Games course have finally been posted here:

    I believe that the course notes will also be posted there soon.


  4. Hey there I am so happy I found your blog page, I really found you by mistake, while I was searching on Bing for something else, Regardless I am here
    now and would just like to say thank you for a remarkable post and
    a all round exciting blog (I also love the theme/design), I don’t have time to look over it all at the minute but I have bookmarked it and also
    included your RSS feeds, so when I have time I will be back to read a lot more,
    Please do keep up the awesome jo.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: