Archived

This topic is now archived and is closed to further replies.

rendering far away

Recommended Posts

conman    181
I implemented the vegetation for a game engine. It''s a complex thing, but I have a special problem and need some ideas about it. If I render a tree with trunks and leafs it looks great form a small distance but if you watch the same tree form far away the leafs seem to dissapear. There is no crown at the tree. This is a resolution problem I guess but are there any ideas how to work around? Hope the problem is clear... If someone explanes me how to post pictures in this forum I can post a small image to show this effekt. Thanks! Constantin

Share on other sites
juuso    289
Try mipmapping. It basically creates low-detail versions of the texture, so it looks like a smoothed version of the original, when far away.

There's lots of tutorials about it, at NeHe, gametutorials, and everywhere.

Edit:
If you are rendering the leaves polygonally, and not using a texture, this doesn't work. Don't know your method.

[edited by - juuso on January 15, 2004 1:13:25 PM]

Share on other sites
quote:
Original post by conman
If someone explanes me how to post pictures in this forum I can post a small image to show this effekt.

like this:
<img src = "http://www.whatever.com/myimage.jpg">

Share on other sites
conman    181

The tree from near and the same tree form far away.

I don't think that mipmapping will help here cause it is not a billboard it is build up polygonally only the leafs are bitmaps. It looks more like a floating point problem or.. I don't know...

[edited by - conman on January 15, 2004 1:42:55 PM]

Share on other sites
y2kiah    2031
You could do like a lot of other outdoor engines do and switch the 3d model to an imposter when it gets far away. The imposter would just be a billboard with a rendering of the tree on it. This will speed things up too, especially if you have a lot of trees to render.

Share on other sites
There are two techniques you can use.

Firstly FSAA: You can enable multisampling in OpenGL with the GL_ARB_multisample extension. This will make the trunk and branches look better, but it won''t solve the leaves problem, since it only smooths the edges of primitives. (Supersampling FSAA would work for the leaves too, but its only supported on nvidia cards, and there''s no way to enable this through OpenGL AFAIK - you''d have to set it manually in the driver settings.)

I''m assuming you''re alpha testing the leaves ATM. To get an antialiased effect on the leaves, you could use mipmapping and alpha blending, with a GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA blend function, ideally with the leaves sorted from farthest to nearest.

This is all likely to have a significant performance hit. To minimise it, you should use a radix sort for the sorting, and imposters may also be a good idea, as y2kiah points out (ideally blended rather than alpha tested).