When playing with game engine ideas, I struggled with the fact that my laptops all had very very bad integrated chips by Intel. Yeap, those ones.
I wanted a nice cartoony fluffy clouds and bobbly trees, but all those spheres were taking just too many polygons.
The solution I prototyped was to bill-board spheres… complete with depth.
The billboard image was actually a depth-map. I was using a special value to indicate no texel and do a discard in the fragment shader.
To get nice edges on the spheres I did it in two passes; first pass, draw all opaque texels inside the circle of the billboard, setting depth; second pass, draw all semi-transparent texels on the edges of the spheres without setting depth (i.e. its at billboard depth).
I found that I could draw almost a thousand such spheres at a good enough framerate on the worst cards. On more average ATI and NVidia cards the framerate was nicely in the hundreds. So this is a very efficient technique.
Shadows can be done by sampling the depth buffer in a second pass and using a 1D texture that is the cross-section of the sphere. I didn’t prototype that bit; its an exercise for the dedicated reader ;)
Notes
-
williamedwardscoder posted this
↓ click the "like" button to share on twitter and facebook!