Skip to main content
GameDev.net gamedev.net
🔒 Locked

Convincing trees

Started by VanKurt May 15, 2003 at 11:38 AM 95 replies 37.6k views
Original Post
VanKurt
VanKurt
I''ve been reading through all the posts I could find on this page for more than an hour now but didn''t find satisfiing answers. I also have played games like GhostRecon, Battlefield, MotoCrossMadness2 but couldn''t really find out how they do it. Well, if you''re far away from the tree it is just a simple billboard. If you come closer it is faded into a real 3D object. That isn''t hard to do... But my problem is that I don''t know how to visualize the 3D Object. The trunk wouldn''t be too hard (a simple mesh). But what about the leafs? How do games (like mentioned above) realize them? Special textured quads along the branches? A 3D trunk and a billboarded Quad for the leafs? Real 3D (procedural) leafs? This slices method from vterrain? Well, I really don''t know... any ideas? Thanks!
mittens
mittens
A really cool way to do trees can be found on the nVidia site. They have an old demo somewhere in their archive that generated a fractal tree. You could generate a few of these fractal trees at runtime, and use them as imposters during run-time... Could work, who knows.

Trent Polack
trent.codershq.com
trent@codershq.com
Author of Focus on 3D Terrain Programming
VanKurt
VanKurt
Imp...Imp...Impoztirors??? Whats that?
James Trotter
James Trotter
Imposters are basically what you were talking about earlier... When the tree gets far enough away from the camera, exchange it with a billboarded quad.
VanKurt
VanKurt
Actually I don''t believe that procedural trees can look good ;-)
(I mean in comparison to artist made ones)
VanKurt
VanKurt
...and I didn''t see them being used in games...
Yann L
Yann L
Heh, a couple of days ago, I implemented a new tree (and general vegetation) renderer for our engine. I''ve tried a *lot* of different approaches, but wasn''t really happy with any of them. I finally settled with a hybrid 3D/2.5D/2D system, much like a grass renderer, but suited for large scale instanciated objects.

The idea is to render a full 3D tree near the viewer, with trunk, branches and leaves all 3D. Then, when the camera moves away, you can gradually switch to other, less expensive solutions. And that''s where the trouble begins. The trunk and branches are easy, a standard geometric LOD system performs very well here (QSlim for example). But that doesn''t work on the leaves. So I first tried a volumetric approach: rendering the leaves as a sliced set of aligned textures. That looks more or less OK, but takes a huge amount of memory, and can lead to weird visual artifacts, when the trees shape is very irregular (branches fading in and out).

So, I finally used a different method: The tree foliage first gets planar patched, ie. transformed into larger face sets, containing several leaves on a alpha blended planar layer. That looks nice, but takes quite a lot of fillrate. Still not optimal. I was thinking of dynamic parallax layers instead, those should give similar visual results but lower fillrate costs. I haven''t yet tried them.

When the camera gets even further away, I render the tree into a texture, and use that texture as a billboard. The z-information is preserved as an 8bit bumpmap over the billboard, allowing 3D lighting of the tree. That part works very well, is fast, and pretty realistic.

And finally, if the tree is really far away, I drop the bumpmap. Simple per vertex lighting of the quad is enough at those distances.

All in all, I''m happy with the quality and performance. I can post some shots, if people are interested. The only part that makes me still somewhat uncomfortable, is the second LOD, between the full 3D and the bumpmapped billboard. I don''t know, I''ll probably try out some alternatives.

If anyone has weird ideas about organic vegetation rendering, esp. trees, it would be nice if you''d share. Even if it''s totally bizarre, or you think it wouldn''t work, just post it. Sometimes the most weird ideas can get the best results
blue_knight
blue_knight
I''d be interested in seeing some screenshots. I''ll let you know if I can figure out a better way of doing intermediate detail levels (before the bumpmaped quad) when I get to that part of my engine.
WarAmp
WarAmp
In my crap ass renderer, I procedurally generate trees, trunk/branches in full geometry, leaves as sets of textured quads..(but i''m unhappy with that atm), anyhow, as the trees get further away, i start dropping branches below a certain size, and at the lowest detail level, all I draw are the leaves...looking into a valley full of trees from 700 - 1000 meters away, only seeing the leaves is good enough at that distance.
Waramp.Before you insult a man, walk a mile in his shoes.That way, when you do insult him, you'll be a mile away, and you'll have his shoes.
Arch@on
Arch@on
What does neverwinter nights use to produce the bigger trees? They really looked great.
VanKurt
VanKurt
@Yann
Yeah, some screenshots would be great!

@AP
Procedural trees with 50.000+ leafs, all detailed objects, hundreds of branches and high quality textures can look really realistic. But not in realtime! (At least I couldn''t manage to do this ;-) )
VanKurt
VanKurt
That''s the kind of tree I''m dreaming about:





;-)
James Trotter
James Trotter
I would love to see some screenshots too =)... I guess I''m going to be doing this in my engine soon enough..
VanKurt
VanKurt
Do what in your engine? The same as Yann?
Am I surrounded by uber-gods? ;-)
Yann L
Yann L
OK, here are some very preliminary shots. It''s only a single tree per shot, as I''m currently adjusting the LOD thresholds and lighting. They will look much better in a large forest. Both trees are fully procedural. They are animated in realtime, ie. branches and leaves move in the wind, etc.




Hairybudda
Hairybudda
Nice yann, could you post some lower LOD images though? And do you have any links on procedurally generating (general)vegetation?
Before, in a past engine, what i would do in my second level of detail would be isolate the tree and render it from different angles and then just texture 2 coplanar quads with it, but as you can guess, this looked horrible and never lent itself to large patches of trees
st0ned
joelmartinez
joelmartinez
Yann ... you never cease to amaze me ... sorry to add nothing to the discussion, but that''s pretty frickin amazing.

Joel Martinez
http://www.codecube.net/
Joel Martinez
http://codecube.net
[twitter]joelmartinez[/twitter]
Yann L
Yann L
quote:
Original post by Hairybudda
Nice yann, could you post some lower LOD images though?


They are already at a lower LOD: the trunk/branches are optimized to about 30% of their original faces at that distance. The leaves are partially patched in coplanar sets.

quote:

And do you have any links on procedurally generating (general)vegetation?


Sure. Try XFrog. That's the tools I used to create the basic tree skeletons. You can get extremely realistic trees with this great piece of software, but keep in mind, that those trees will range from 20k to over 200k faces per tree. So make sure, that your LOD and engine is up to it.

quote:

Before, in a past engine, what i would do in my second level of detail would be isolate the tree and render it from different angles and then just texture 2 coplanar quads with it, but as you can guess, this looked horrible and never lent itself to large patches of trees


Hmm, coplanar ? Do you mean perpendicular (ie. the classical X-shape) ? Or did you use real shifted coplanar shells, like in volumetric rendering ?


[edited by - Yann L on May 16, 2003 5:23:17 PM]
VanKurt
VanKurt
*uaa cry* that''s not fair!!! *snief* I''m a loser...
...my x-billboards suck...


THATS AMAZING YANN! (What Engine is that your''re working on? Doom4, HalfLife2, Unreal3 ????) ;-)
Alimonster
Alimonster
quote:
Original post by VanKurt
*uaa cry* that''s not fair!!! *snief* I''m a loser...
...my x-billboards suck...


THATS AMAZING YANN! (What Engine is that your''re working on? Doom4, HalfLife2, Unreal3 ????) ;-)

Some more of Yann''s work for you.

I love it when Yann 0wns threads.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.