Outerra forum

Outerra Engine => Technology => Topic started by: oli_chose123 on December 22, 2009, 05:48:10 pm

Title: Trees
Post by: oli_chose123 on December 22, 2009, 05:48:10 pm
Hello, I was wondering how your trees are generated. Are they models or do you generate them?
I'd also like to know what are your plans for the vegetation and to get that feel of variety.

I just finished my course in programming and had plans to create my own little "forest" engine, and would love to hear how you'll take care of it.
Title: Trees
Post by: cameni on December 23, 2009, 09:22:06 am
Hi,
The trees are just billboards, but we will be also switching to models up close. I guess there can be around 200,000 of such trees rendered in an average forest scene, maybe more - maximum density is ~44,000 trees per square km, one tree in one 4.8x4.8m cell. Performance depends on the actual density of the trees on the visible terrain tiles - for the areas that are almost completely covered by trees that that would make 400-500 thousand trees rendered.

Billboards are generated at run time by a geometry shader from a tree coverage map (per terrain tile). The map is computed using local terrain properties like elevation, slope and curvature, combined with fractal noise values to get the fractal-like distribution of trees in nature.

As for the plans - the vegetation will be derived from land type layer with 500m resolution. Each land type defines probabilities of occurrence of distinct vegetation types, which will be generated and mixed using fractals in a way that preserves the probabilities. The attainable variety of vegetation should be sufficient, problem will be to collect data for all the vegetation types for all the land classes we'd like to have.
Title: Trees
Post by: Crashy on August 27, 2011, 03:43:05 am
HI, sorry to bump a two years old topic, but I'm trying to implement a technique similar to the one you described in this topic.

I've made a geometry shader that samples a coverage map to generate two triangles per tree, for the moment the tree denstiy is less than the density I can see on your screenshots, but the framerate is really low(I've got an AMD HD 4870 video card), and the triangles aren't even billboard-ed. I get better performances with triangles batched in a vertex buffer and billboarded with a vertex program, but your technique has flexibility benefits I'd want to have in my engine.

I'm new at geometry shader programming so I may have done something unoptimized, is it possible to have more infos/hints about how you're doing this?

Thanks.
Title: Trees
Post by: cameni on August 27, 2011, 04:12:27 am
Geometry shaders are relatively slow, the only reason that we can use them with an advantage is because the computation of atmospheric lighting can be performed for the whole tree in a geometry shader, instead of executing it four times in a vertex shader. But if you can't drag enough of common code from VS into GS to compensate for its penalties, it will be slower. We are probably going to optimize it by computing the atmospheric parameters to an auxiliary texture (for every taken tree position) and then using it from VS - that could be a bit faster, avoiding GS entirely.

Other than that, we aren't sampling the coverage map from GS, instead we create a vbo containing all the info about trees - mainly the ground level and type info, and bind it as an input stream for the shaders. GS then quickly rejects the nodes without trees; the same can be done by collapsing the geometry in VS for instances with no trees.
Title: Trees
Post by: Crashy on August 27, 2011, 04:53:52 am
Okay I understand then.

Thanks a lot for your help, it's quite rare from people as skilled as yout to give such detailled informations:)
Title: Re: Trees
Post by: foxfiles on May 16, 2012, 04:29:27 am
did you experiment with this technique for some of your trees/objects representations?
http://www.antisphere.com/Research/VolumetricBillboards.php (http://www.antisphere.com/Research/VolumetricBillboards.php)
Title: Re: Trees
Post by: angrypig on May 16, 2012, 08:26:27 am
I know this paper and there are more similar papers on the internet. I didn't experiment with similar techniques yes but i am thinking to try GigaVoxels for middle range trees because GigaVoxels with sparse octree structure should be less demanding for memory than slices in 3d texture or impostors. And the second possible technique is the one used in Erick Bruneton's engine but it has to be modified/simplified because it needs a lot of memory and is slow.

http://maverick.inria.fr/Publications/2009/CNLSE09/ (http://maverick.inria.fr/Publications/2009/CNLSE09/)

http://www-evasion.imag.fr/Membres/Eric.Bruneton/ (http://www-evasion.imag.fr/Membres/Eric.Bruneton/)
Title: Re: Trees
Post by: PRiME on May 16, 2012, 09:17:33 am
those look very very cool, not sure what performance hit is but may be a good solution for semi-close trees before they go full 3d (which you would expect to consume considerable more processing power)
Title: Re: Trees
Post by: foxfiles on May 16, 2012, 10:35:10 am
I look forward to seeing your trees  :P
and I am sure they will be of better natural aspect than proland's-ones
Title: Re: Trees
Post by: angrypig on May 16, 2012, 10:44:57 am
It is not about better nicer or something like that it is about performance. Trees are not the only thing in the scene, so the primary goal is the performance...
Title: Re: Trees
Post by: PRiME on May 16, 2012, 09:19:06 pm
You should slap in a couple close/near tree rendering techniques in the options menu and let users try out each and offer feedback.
Title: Re: Trees
Post by: Spudly on May 16, 2012, 10:27:29 pm
You should slap in a couple close/near tree rendering techniques in the options menu and let users try out each and offer feedback.

I think this would be cool, but "slap in" is probably not the right term for something that would take months...
Title: Re: Trees
Post by: ChookWantan on May 17, 2012, 01:01:17 am
You should slap in a couple close/near tree rendering techniques in the options menu and let users try out each and offer feedback.

I think this would be cool, but "slap in" is probably not the right term for something that would take months...

A reeeeeeeeeally slow slap, then?
Title: Re: Trees
Post by: PRiME on May 17, 2012, 02:15:11 am
They actually have them mostly done from what I can tell, there are screenshots and even a movie I think of them in action. I believe that its more of a performance reason why its not in yet, perhaps they will ad it in as a option in the graphics settings at some stage for testing. Allot of people are still using quite old hardware btw.
Title: Re: Trees
Post by: cameni on May 17, 2012, 03:28:59 am
It's more because the integration isn't complete yet, trees don't transform into corresponding billboards in the distance. But we will probably put it into the WIP section after the objects are done, for people to play with. It should be the next thing after the objects anyway.
Title: Re: Trees
Post by: KelvinNZ on May 17, 2012, 05:52:31 am
Hi,
The trees are just billboards, but we will be also switching to models up close. I guess there can be around 200,000 of such trees rendered in an average forest scene, maybe more - maximum density is ~44,000 trees per square km, one tree in one 4.8x4.8m cell. Performance depends on the actual density of the trees on the visible terrain tiles - for the areas that are almost completely covered by trees that that would make 400-500 thousand trees rendered.

Billboards are generated at run time by a geometry shader from a tree coverage map (per terrain tile). The map is computed using local terrain properties like elevation, slope and curvature, combined with fractal noise values to get the fractal-like distribution of trees in nature.

As for the plans - the vegetation will be derived from land type layer with 500m resolution. Each land type defines probabilities of occurrence of distinct vegetation types, which will be generated and mixed using fractals in a way that preserves the probabilities. The attainable variety of vegetation should be sufficient, problem will be to collect data for all the vegetation types for all the land classes we'd like to have.

The challenge does appear to be the availability of all vegetation/tree types. There must be a data set out there somewhere that could fill this void? Surely!
Title: Re: Trees
Post by: foxfiles on May 17, 2012, 07:29:48 am
There are several of such libraries of 3D plant models Onyxtree, Bionatics, Xfrog, speedtree, etc...
with hundreds of species, at various growth stages for each tree.
They are even sorted per regions (ex: Europe, USA, Japan) and are available with several representation versions for rendering at various levels of details.
 So static material to work with exist and I am pretty sure that our OT's friends know a lot about these libraries.

But they have a price, represent a large amount of data, they are static models and so on...

The most complex thing is also what Cameni's saying above : create the method(s) to "automatically populate" the vegetation on the ground  :-X
it's based on many rules : Earth's biomes, seasons, terrain topo, densities, statistics, probabilities, etceterra  -------- well it's a big subject in itself
 
Title: Re: Trees
Post by: Midviki on August 05, 2012, 10:42:29 pm
The most complex thing is also what Cameni's saying above : create the method(s) to "automatically populate" the vegetation on the ground  :-X
it's based on many rules : Earth's biomes, seasons, terrain topo, densities, statistics, probabilities, etceterra  -------- well it's a big subject in itself

So... without a method...if we would like to hand pick our own personified models of tree's and place them one by one in some zone, we won't be able to use too many of them or something like that?Even if we have lets say 16GB or 32GB of Ram?Can they be all loaded?.. And I'm not talking about UFO speed, I mean normal walking and you would see tree's from the other hill or top of the mountain, will it be?And probably the lighting will work as on buildings since those tree's are objects like buildings I guess, right?
Title: Re: Trees
Post by: cameni on August 15, 2012, 05:12:54 am
If you place trees individually as objects, they will be treated as objects, limitations on the number of them will apply. It's not a problem of RAM on the CPU, but on the GPU. However, it's the model size what counts, multiple instances of the same tree don't take much space.

With trees it's even more important to have good LOD levels.
Title: Re: Trees
Post by: Midviki on August 29, 2012, 08:45:56 pm
Yep.. especially if you want to cut them down... or crash a 747 plane in the middle of the forest. ;D