rendering far away

Started by
5 comments, last by conman 20 years, 3 months ago
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
Advertisement
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]
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">




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]
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.
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).

____________________________________________________________www.elf-stone.com | Automated GL Extension Loading: GLee 5.00 for Win32 and Linux

Thanks for your replies! I think benjamin is right. The problem is the subsampling of opengl. I turned on FSAA and got much better results...
Constantin

This topic is closed to new replies.

Advertisement