Wednesday, December 15, 2010

Imposters - quick rendering for complex models

Blue Spruce Tree Asset

I've been looking to fill in some assets for the game as of late.  A key piece to adding "beauty" and complexity to the scenery is vegetation.
Vegetation is also the primary reason I was looking into geometry instancing.  Trees seem to weigh in at 1000+ (up to ~40k) polygons for trunk and leaves, and I don't think that load of polygons will scale well performance wise.
So I've been researching using Imposters to improve performance.


Imposter example (1)

"Dynamic" and "Static" Cached Imposters
Before I get too far, to clarify, I've seen primarily two flavors of imposters, I'm going to label them "dynamic cached" and "static cached".
An example of dynamic cached imposters can be found here: http://www.gamasutra.com/view/feature/2501/dynamic_2d_imposters_a_simple_.php?print=1
That said, I don't plan to use "dynamic cached", I plan to use "static cached" imposters, caching the generation of the imposters at a fixed resolution and regular angular intervals, so tha many instanced models can use the same imposter data.
The end result would be something similar to what's used here:
(example of "static cached" imposters)
http://blog.wolfire.com/2010/10/Imposters

Color, Normal, and Shadow, Packed Texture Data (2)

Differences:  I don't plan to pack any baked shadows/shading info.  But I am thinking of packing in the z-buffer value or the full 3d value, scaled, to try to use with Shadowmaps (not yet sure if it'd be accurate enough, given angle error of the imposter, see http://www.dgp.toronto.edu/~schubert/imposter.html for more information of error introduced by angle error.)


Reference (Correct) View (3)
Angle Error Stretching  (3)
Conclusion
The next step is to throw together a shader for creating the imposters, and another for rendering imposters.  (At the moment I'm not planning to transition between imposter and real object, it's either one or the other.)

It's probably not a bad idea to generate the imposter data offline, and have the shader for rendering imposters have inputs for the data.  This allows for use of an editor (e.g. 3dsMax) with explicit control over use of imposters in-scene, as imposters, with correct shader, etc.
(The model would be simply a quad, which I'm ok if it's not instanced.)

Sources:
1. http://www.gamasutra.com/view/feature/2501/dynamic_2d_imposters_a_simple_.php?print=1
2..http://blog.wolfire.com/2010/10/Imposters
3.http://www.dgp.toronto.edu/~schubert/imposter.html

No comments:

Post a Comment