Convincing trees

Started by
95 comments, last by VanKurt 20 years, 8 months ago
quote:Original post by VanKurt
That's not realtime, is it?????? ;-)
He claims they are. This thread might interest you: http://www.gamedev.net/community/forums/topic.asp?topic_id=150794

EDIT: The first posts in that thread stronly relates to Hairybudda's comment above.

[edited by - CWizard on May 17, 2003 9:02:44 AM]
Advertisement
quote:
Could please somebody else than Yann post some shots of his/her trees and plants? Just that I have something to compare / orientate myself to.... ;-)

What Yann does is simply beyond my capabilities!

Of course it is not. It's very simple, actually. The basic idea goes like this: you draw a 3D tree model, when the camera is very near. If you create that 3D model procedurally, or by some artist is pretty much irrelevant. It's just a mesh like any other object. The problem is, that if the camera is far away, you tend to have lots of those 3D trees in the view. And that brings us a face-count problem. The solution is a LOD algorithm.

Try this: aquire some 3D tree or plant model. Any will do, wether you use XFrog (they have a free trial version to d/l), you model it yourself, rip it from some game, or take some free model on the net (have a look at 3dcafe.com). Start by rendering it normally, like all other objects you have. Now, from a certain distance on (try out various settings), you don't render your tree to the screen, but to a texture (a simple RGBA texture is perfect). From now on, you can simply render this texture as billboard, unless the camera gets nearer again. In that case, trash the texture, and render the full 3D again. Repeat.

quote:
How about slowly squashing the tree until it collapses in to a billboard over distance. That way you would still have the perspective advantage over a greater distance. And of course cut away on the tree more generously as it moves away?

That's pretty much what I'm currently doing. The problems I have: first, it doesn't work too well, if the camera is still near enough to see the 3D structure of the tree, but far enough to trigger a first LOD level. ie, I need a different system for an intermediate LOD. Second, dynamic lighting should stay consistant with those billboards, ie. it shouldn't suddendly change as the LOD squashes the tree. The bumpmap kind of resolves that, but it's not perfect yet. Third, the whole thing takes quite a lot of texture memory.

quote:
Did I get that right, Yann?
You don't use a premade billboard, but render it in realtime?

Yes. That way, your are less likely to notice the switchover (actually, it is totally invisible), and keep persepctive, current orientation and lighting.

quote:
Yes I agree, that never occured to me -- rendering the 3D model (however it's generated) to a billboard on an individual basis and rendering that when it's far away. But it seems like a video-memory hog if you've got many of them,

Yes, that's true. You need a good LRU cache. But since I use that LOD only at far away distances, I can get away with 32², 64² or at most 128² textures.

quote:
not to mention the time it takes processing each tree,

It takes the same time as rendering it to the screen. Only once, at the switchover point, and you have the texture. Not really an issue.

quote:
and the fact that changing the camera's position means you'd have to re-render the trees close enough to be affected by that.

That would depend on your distance thresholds. The system is very efficient, if you use it at larger distances, so that the camera position doesn't affect too many trees, and the general error term stays very low. The system is not suited for very near trees, rebuilds are too frequent, and it takes huge amounts of texture memory (you'd need 512² maps or even more).

quote:
I suppose these problems can be alleviated by only using this method for not-very-far trees and using a generic billboard for further ones...

You could do that to cut the texture memory costs and state changes down, but it won't influence processing speed. At large distances, you'd pretty much never need a texture rebuild.

quote:
what is the lighting on the screenshots you showed?
The tree seems to shadow itself, yet there's nothing on the ground.

Quick'n'dirty radiosity (ie. I didn't want to wait for a full solution). The general shadow casting system was disabled, that's why there are no shadows on the ground. As I said, it was only a test to adjust various parameters.

quote:
These leafs seem to be a texture on a more or less detailled quad/sphere (or whatever)... how are they generated, so that they fit so perfectly?

That's the job of the artist. From a modelling point of view, those objects are often created with tools like Deep Paint or similar: the artist models the tree/plant, and then 'paints' the texture on it (in 3D). The result is a perfect-fit texture for the whole object. A similar technique is often also used for characters. But you need a skilled artist for that, it isn't easy.

quote:
No offence to Yann_L or anything, but could you guys kindlyt remove you lips from his anus?

Hmm, I think I should take those game shots down, actually. I mean it's nice if people like them. But if you can't have an unrelated discussion anymore, without having a link to our site popping up every two pages, then it gets a little annoying. Especially for the original poster. This is a discussion about trees and organic rendering, not a commercial presentation for our game. I would appreciate, if we could keep it like this. Thanks.


[edited by - Yann L on May 17, 2003 9:38:33 AM]
Oh, btw VanKurt, if you don''t want to model your own trees, and don''t want to use procedural tools either, have a look here: 3D cafe''s planet and tree section. Tons of nice stuff to download, and perfect to test your tree renderer.
I played with another idea a while ago; unfortunately i no longer have screenshots on my hard drive so i can''t show it, but the results were pretty decent.

A standard LOD algorithm, as Yann said, was applied to the trunk and branches. For the leaves i took a different approach though. All the leaves were billboards, but on the tree there was many billboards of different sizes at the same time; ie. 4 or 5 "huge" billboards with a high-number of leaves textures; maybe 30 "average" billboards with 3 to 10 leaves in it; and finally a few hundred of small billboards with individual leaves. At run-time, the only thing needed was to decide if the viewer was far away to display smaller billboards or not; if not, they were faded away with blending.

Results were half-decent and performance ok; the only thing is, when coming "inside" the tree you were able to tell that the bigger leaves'' billboards were fake. I dropped the idea for that reason, but for the 10m->1km range, it worked quite well.

Y.
Another question for Yann here, if he doesnt mind. I remember from a while back that you use a 3 dimensional grass system, similar to the one described in the paper ''animating prairies in realtime''. In an earlier thread, you said one of the ideas you borrowed and modified was the weather primitives concept. Now, i was just wondering, do you animate the tree in any way? I mean, having a nice field with grass blowing in the wind, and then having a nice big tree sitting there statically, without any branch/leave animation will kinda kill the effect. And then, if, at further levels of detail, how do you simulate animation, cos i mean, you cant just alter the edges of strip that your tree is rendered to, because that would animate the trunk too, and would look kinda silly. Oh, and also, if you do animate the trees, and you do have it looking nice, how do you do the transitions between your levels of detail, in particular the leaves, if they''re animated? Because, i mean, would it not look like leaves are just ''popping in'' at different positions as the LOD changes?

PS, i like the bump-mapped imposter idea that you said you use, that would give the impression of depth wouldn''t it? Instead of a statically lit tree?
*st0ned*
quote:Original post by Yann L
Hmm, I think I should take those game shots down, actually. I mean it''s nice if people like them. But if you can''t have an unrelated discussion anymore, without having a link to our site popping up every two pages, then it gets a little annoying. Especially for the original poster. This is a discussion about trees and organic rendering, not a commercial presentation for our game. I would appreciate, if we could keep it like this. Thanks.

No offence intended or anything, you''re as much an inspiration to me as you are to the rest of us aspiring graphics programmers.
I mean, we all like the odd nice comment, relating to our efforts, but you really must get as annoyed as we do when we''re looking for guidance in a thread, and all we see are ''YANN_L WE LOVE YOU'' and the likes.
I mean, dont take your screenshots down or anything, its nice to see them once in a while, and the quality of the shots pimp themselves, but to have every other person pimping it for you is kinda annoying too.
You''ve been a great help, and your screens do really help your explanations, and i dont want you to stop posting here because of the people constantly pimping it for you, or the disgruntled few who dislike your ''following''. You know what i mean? Or am i just rambling?
Hope you get my point, its in there somewhere :D Just trying to say what ''no offence intended'' meant in that post
*st0ned*
* Sorry for going a little off topic! *

quote:Original post by VanKurt
Do what in your engine? The same as Yann?
Am I surrounded by uber-gods? ;-)


What I meant is that I''m going to do tree, and vegetation rendering, in my engine... Possibly using some of the same techniques as Yann, maybe not... I can try anyway.

Oh, and Yann, amazing trees!! Well done!

quote:Original post by Yann L
That''s pretty much what I''m currently doing. The problems I have: first, it doesn''t work too well, if the camera is still near enough to see the 3D structure of the tree, but far enough to trigger a first LOD level. ie, I need a different system for an intermediate LOD. Second, dynamic lighting should stay consistant with those billboards, ie. it shouldn''t suddendly change as the LOD squashes the tree. The bumpmap kind of resolves that, but it''s not perfect yet. Third, the whole thing takes quite a lot of texture memory.


Hmm, ok. How about this then. Try and place smaller billboards for the brances that are victims of LOD and over time have them placed into a larger billboard. It would mean more textures though and I am not certain if you are reaching the limit already.

____________________________________________________________
Try RealityRift at www.planetrift.com
Feel free to comment, object, laugh at or agree to this. I won''t engage in flaming because of what I have said.
I could be wrong or right but the ideas are mine.

No no no no! :)
quote:
A standard LOD algorithm, as Yann said, was applied to the trunk and branches. For the leaves i took a different approach though. All the leaves were billboards, but on the tree there was many billboards of different sizes at the same time; ie. 4 or 5 "huge" billboards with a high-number of leaves textures; maybe 30 "average" billboards with 3 to 10 leaves in it; and finally a few hundred of small billboards with individual leaves. At run-time, the only thing needed was to decide if the viewer was far away to display smaller billboards or not; if not, they were faded away with blending.

Sounds interesting. How did you create the multi-resolution billboards, by hand or procedurally ?

quote:
Now, i was just wondering, do you animate the tree in any way?

Yes, the branches and leaves are animated in the wind. It''s a pretty basic system, simply applying a veriable bend on the branches, and a rotation on the leaves. The whole thing has to be performed in a vertex shader to be effective.

quote:
And then, if, at further levels of detail, how do you simulate animation, cos i mean, you cant just alter the edges of strip that your tree is rendered to, because that would animate the trunk too, and would look kinda silly.

That''s one of the big problems with tree LODs, unfortunately. On the medium to far distance, you can animate the bumpmap, or simulate the effect via an animated environment cubemap. This will simulate the animation of the leaves based on lighting. Looks pretty good. But on the intermediate LOD level, this is a problem. At least with the foliage, the trunk + branches work well, since you basically apply a standard geometric optimization, which doesn''t prevent animation in any way.

quote:
PS, i like the bump-mapped imposter idea that you said you use, that would give the impression of depth wouldn''t it? Instead of a statically lit tree?

Yes, if the lighting is good. I suggest using per-pixel EMBM into a low-res environment cubemap per tree. Each tree (or group of trees) has it''s own cubemap, but since the resolution is very low (something like 16*16*6 should do it), memory is not a problem. That way, you can encode local lighting and shadowing information for each tree or tree group instance. On a full 3D model near the camera, you simply derive the lighting from a cubemap lookup, and you have the self-shadowing encoded in the tree''s vertices (it''s the same for all tree instances, independent of position). For far away, bump-mapped billboards, you would use the EMBM to simulate the cubemap lookup per-pixel. I implemented the system this morning, and I''m very happy with the lighting quality. It also makes animation lighting trivial.

quote:
Hmm, ok. How about this then. Try and place smaller billboards for the brances that are victims of LOD and over time have them placed into a larger billboard. It would mean more textures though and I am not certain if you are reaching the limit already.

I''m using a similar concept, but for leaves only. I''m pretty sure, that it is the way to go, but I''m not yet happy with my implementation. The problem is the way the larger billboards are procedurally derived from the original model, my system is still suboptimal. There are a few papers about similar techniques (eg. this one, from EG''02), but I don''t really like the visual results either. Too many artifacts, IMO. I will continue to try different approaches in creating the larger billboards, I guess there must be an acceptable solution.
quote: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


Yann- Though I have yet to implement the idea fully, I've had some fun implementing a general structure for speeding up pseudo-tree processing. Since I'm trying to support bare-minimum 3D in my current game (Voodoo3 PCI on a PIII 500), I spend probably far too much time toying with visualization and optimization tricks.

Disclaimer: I haven't researched existing tree algorithms yet.

I have noticed that a majority of trees/bushes can be modeled as specialized particle emitters. Eg: vegetation firework trails. There are two types of "explosion" - kinks and branching. By nature branches also have a competing natural tendancy either towards the sky or the ground (gravity/antigravity). Bushes have no kinking and minimal but constant distance between branching and explosion. Palm trees have exponentially decreasing distance between branching and have one kinking at base. Oak trees are a balance of all. Weeping willows have slowy decreasing distance between branching and have high gravity.

There are two puzzle pieces for the trees - joints and legs, deformed by a slight random nudge as particles travel, and shrinking as they go.

Though it may be amusing, so far my leaves are being implemented as colored light bursts (read: I have 2 cents worth of texture memory), but I'm leaning heavily towards the pre-lit and billboarded small leaves after I get it working.

The trees are fillrate dependent (i.e. particles have a time-to-live during tree setup) so on slower systems the trees are sparse and stunted, but have the same basic branching as a full on graphics powerhouse. ( bragging rights based on how big your trees are? )

All data generation is fed from a different interpretation of my perlin noise landscape textures stream. I don't know if I'll have any fillrate left over for branch/leaf animation, presumably not, but I'm sure I'll toy with it.

-Charlie

[edited by - vystrax on May 17, 2003 12:33:30 AM]

[edited by - vystrax on May 17, 2003 12:35:14 AM]
A conclusion is simply the place where you got tired of thinking.

This topic is closed to new replies.

Advertisement