Jump to content
  • Advertisement
Sign in to follow this  
BlazingClaymore

How to render trees?

This topic is 4049 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

well I am working on a game engine but I can't get the trees to look right. see I need to use mipmaping on the trees because they don't render fast enuff if I don't but if I do the leafs get all messed up because it also mipmaps the alpha. so does any one know how to get around this problem?

Share this post


Link to post
Share on other sites
Advertisement
Only mip-mapping will not really speed up your tree-rendering, and indeed will give you the problems you already experienced.
To speed up things, render tree-models with less polygons when they're far away. Or even simply render a flat image of a tree when they are really quite far (google for 'impostor rendering' to see how to do that).
This paper might help...

Share this post


Link to post
Share on other sites
come on i'm sitting here wating for some one to reply need help the game is way better then any of you can dream it uses PhsyX it runs great. I'm going to make an MMO and any one that helps me I will give game items to please!!!!!!!!!!!!!!!

Share this post


Link to post
Share on other sites
DaBono gave you good advice. Maybe you could investigate the rest of what he said (using less polygons or impostors at a distance) instead of just "sitting there waiting for someone to reply."

Share this post


Link to post
Share on other sites
Quote:
Original post by BlazingClaymore
come on i'm sitting here wating for some one to reply need help the game is way better then any of you can dream it uses PhsyX it runs great. I'm going to make an MMO and any one that helps me I will give game items to please!!!!!!!!!!!!!!!
[lol] I like the joke, but do remember this forum is for the entire community and not just your personal Q&A board. Also remember that the people replying to your questions are doing it on a purely voluntary basis, so demanding they pay attention to your thread is, well, a little rude [wink]


Anyway, trees.

It's not a simple problem as they tend to be highly complex objects. Imposter rendering is a very good idea - definitely research into that.

For getting correct blending you might want to consider the branches as regular geometry and the individual leaves as a form of particle system. Enable Z-testing but disable Z-writing and just draw all the leaves and, whilst not mathematically perfect, you get visually acceptable results.

Have you done any research online? I haven't had to render trees for quite some time, but I'm pretty sure its a well-covered topic so there should be a lot of useful resources out there if you can find them.

hth
Jack

Share this post


Link to post
Share on other sites
Quote:
the leafs get all messed up because it also mipmaps the alpha


Can you post a screenshot of what you mean by "messed up"? Or at least a proper description - do the leaves turn pink and start flashing where the alpha is? we don't know, we're not telepathic and you didn't tell us.


Alpha on lower mip-map levels has certainly worked fine whenever I've used it myself for things like leaves of trees.


A screenshot would also confirm that it isn't a different, unrelated problem that is being made to look much worse by some aspect of mip-mapping (tri-linear filtering for example). All sorts of filtering, anti-aliasing, and bad choice of texture format (like using DXT1 for example) bugs often get wrongly blamed on mip-mapping.

Ok, so assuming mip-mapping is to blame, the first and most important question is how are you generating your mip-map chains?: automatic hardware mip-chain generation?, one of the D3DX functions at load time?, one of the D3DX functions as an offline process?, an external library (such as the nVidia library)?, your own system? (if so, which algorithm? plain box filter? is it gamma aware? does it do any unsharpen mask tricks?). What settings do you pass for your chosen mip-map chain generation system?

You should be able to make your mip map chain generation aware of how you're using alpha for that texture.

For tree leaf edges alpha to coverage is worth a look.



Random guess for the day: change your texture format from DXT1 to DXT5.

Share this post


Link to post
Share on other sites
Quote:
Original post by DaBono
Only mip-mapping will not really speed up your tree-rendering


It won't speed it up, but NOT mip-mapping can slow it down (assuming there isn't a bigger bottleneck elsewhere in the pipeline of course).

Whenever the tree texture gets minified on screen (common for leaf textures, common for forest scenes), if that texture isn't mip-mapped then you're inviting a guaranteed increase in texture cache misses.


Quote:
To speed up things, render tree-models with less polygons when they're far away. Or even simply render a flat image of a tree when they are really quite far (google for 'impostor rendering' to see how to do that).


Agreed, impostors are good; LOD schemes are good, particularly if they can reduce the number of draw calls (it's rare to be vertex processing bound if everything else is 'sane'). Instancing is good for trees too. [smile]

Share this post


Link to post
Share on other sites
Quote:
Original post by BlazingClaymorethe leafs get all messed up because it also mipmaps the alpha. so does any one know how to get around this problem?


In fact this is a common problem..and is a good question. You can simply do two samples, one for the mipmapped color texture and one for the alpha with mipmaplodbias=-0.2 or something... alternately you can just use one sample with the bias, this will look better and still be mipmapped somewhat..any mipmapping is better than none.


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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!