Sign in to follow this  
Hiyar

Foliage Question

Recommended Posts

Hi, I am still looking for a way, how to render foliage. Much of the foliage can be rendered simply using Alpha Testing, but things like grass, shrub etc looks awfull if rendered using Alpha Testing, because of the hard edges. I tried a two pass approach with Alpha Testing/Alpha Blending, and this method gives me the best visual results and no sorting is necassary. But the performance is very bad. So I decided to use Alpha Blending, which requires sorting and is a bit expensive. Is this done in a seperate thread and does it make sense to use dynamic vertex buffers. How is sorting implemented in an optimized way? Thanks

Share this post


Link to post
Share on other sites
I think using alpha blending for large amounts of foliage is bad because it means a lot of overdraw.

If you use alpha testing you should sort front-to-back to reduce overdraw, and then you can do an edge softening method to reduce aliasing. Basically, you should have a depth map rendered, and use that to do an edge-detection filter, which you use to blend in a blurred image of the backbuffer...this method was used in Crysis.

Share this post


Link to post
Share on other sites
Quote:
Original post by Matt Aufderheide
I think using alpha blending for large amounts of foliage is bad because it means a lot of overdraw.

If you use alpha testing you should sort front-to-back to reduce overdraw, and then you can do an edge softening method to reduce aliasing. Basically, you should have a depth map rendered, and use that to do an edge-detection filter, which you use to blend in a blurred image of the backbuffer...this method was used in Crysis.

Crysis used alpha blending for grass, and alpha testing + post processing for other stuff like leaves etc.
Read this and correct me if I'm wrong: Click

Quote:
Original post by flery
some stuff i found:
http://blog.wolfire.com/2009/02/rendering-plants-with-smooth-edges/
http://http.developer.nvidia.com/GPUGems/gpugems_ch07.html

I think the first link suggests two pass approach, I tried this earlier and performance was very bad.
Second link discusses grass animation.

Quote:
Original post by Hodgman
See also:
http://www.valvesoftware.com/publications/2007/SIGGRAPH2007_AlphaTestedMagnification.pdf

I will look into this.

Quote:
Original post by Quat
This doesn't answer your question, but did you look into alpha to coverage? You get soft edges from the alpha test. However, it requires multisampling enabled.

Yes there are different alternatives, Alpha to Coverage is great

but I still would like to know how to optimize sorting for alpha blending. Especially for dense grass rendering.

Share this post


Link to post
Share on other sites
I'm pretty sure Crysis doesn't use alpha blending for grass, but instead uses the the method in that article for everything.

As far as sorting goes, I don't have any great suggestions, other than that you may not have to sort every frame. Instead, you could spread the sort out over a few frames, because a scene will likely not change so much.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this