Jump to content

  • Log In with Google      Sign In   
  • Create Account


Alpha sorting trees?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
3 replies to this topic

#1 polyfrag   Crossbones+   -  Reputation: 1449

Like
0Likes
Like

Posted 13 August 2013 - 04:48 PM

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, 13 August 2013 - 04:49 PM.


Sponsor:

#2 CDProp   Members   -  Reputation: 811

Like
0Likes
Like

Posted 13 August 2013 - 05:36 PM

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.



#3 swiftcoder   Senior Moderators   -  Reputation: 8081

Like
2Likes
Like

Posted 13 August 2013 - 06:53 PM

If your trees are fairly static, you could always preprocess them into billboard clouds...


Tristam MacDonald - SDE II @ Amazon - swiftcoding        [Need to sync your files via the cloud? | Need affordable web hosting?]


#4 Hodgman   Moderators   -  Reputation: 24022

Like
3Likes
Like

Posted 13 August 2013 - 07:13 PM

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.






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS