Jump to content
  • Advertisement
Sign in to follow this  
polyfrag

Alpha sorting trees?

This topic is 1895 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have a strategy game with some 1024 trees with 6 billboard sides each. How do games like SimCity 5 handle transparency? Is alpha sorting the non-intersecting parts of each tree the only way to get rid of the problems of rendering transparent polys in the wrong order? Is this computationally expensive?

Edited by polyfrag

Share this post


Link to post
Share on other sites
Advertisement

I'm not sure exactly what SimCity 5 does, but it's fairly common to disable alpha blending for trees and to just use alpha testing instead. That way, you don't have to do any distance sorting. If you were to do alpha-sorting, I believe you'd have to break up the billboards so that you have no intersecting pieces, and then you'd have to sort them on a polygon level using some sort of BSP tree, and then making a separate draw call for each polygon. Sounds expensive indeed. I suppose there might be some way to leverage depth peeling, but generally-speaking, doing a straight alpha test looks nice enough that a more-complicated solution is probably overkill.

Share this post


Link to post
Share on other sites

There's some interesting techniques in this presentation: http://www2.disney.co.uk/cms_res/blackrockstudio/pdf/Foliage_Rendering_in_Pure.pdf

 

One where they accumulate all the trees to a full-screen buffer using alpha-testing, and then blend that over the scene to get the soft edges you'd usually get from alpha-blending.

 

And another for their grass, where they pre-sort the polygons for n different directions, and then pick the closest match at runtime.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!