Vegetation loader

Post your questions, suggestions and experiences regarding to Image manipulation, 3d modeling and level editing for the Irrlicht engine here.
RdR
Competition winner
Posts: 273
Joined: Tue Mar 29, 2011 2:58 pm
Contact:

Vegetation loader

Post by RdR »

Hello all,

A while ago I created a vegetation loader for TANK@WAR, which loads and creates vegetation on the fly (defined in a vegetation map).
I divided the world in patches so I can determine which LOD to draw or not drawing it at all (depending on camera distance).
I'm using the BatchingMesh to combine all the vegetation together (1 batching mesh per LOD for a patch node) to minimize the draw calls.

World
- X PatchSceneNodes (depending on the defined world and patch size)

PatchSceneNode
- N BatchingMeshes (1 BatchingMesh represents 1 LOD)

Say we have 3 LODs per patch and a patch has plant1 to plant9 it would be something this:
LOD0 = all plants
LOD1 = plant1 to plant6
LOD2 = plant1 to plant3

This all works pretty nice, but this solution uses alot of memory.
So my question is has anybody some suggestions how to improve this (reduce memory usage)?

I could minimize the memory by not using the same plant for each LOD (if they occure in every LOD), but that means I have to draw multiple batching meshes.
But that will decrease the performance

PS:
If you want to see it in action, play TANK@WAR
ErUs
Posts: 165
Joined: Thu Oct 07, 2004 6:13 pm

Re: Vegetation loader

Post by ErUs »

I'm not sure what you mean by vegetarian. Is the main character in your game a vegetarian? are you trying to load the player model?
serengeor
Posts: 1712
Joined: Tue Jan 13, 2009 7:34 pm
Location: Lithuania

Re: Vegetation loader

Post by serengeor »

ErUs wrote:I'm not sure what you mean by vegetarian. Is the main character in your game a vegetarian? are you trying to load the player model?
What the F :shock:
Working on game: Marrbles (Currently stopped).
ACE247
Posts: 704
Joined: Tue Mar 16, 2010 12:31 am

Re: Vegetation loader

Post by ACE247 »

Seconding serengeor. What the FFFF? :shock:
But I bet something went terribly wrong with google translate and other language interpretations...

On a different note, RdR maybe you could outline your algorithm a bit more. Maybe profile it a bit?
Is likely some lookop function, draw call or otherwise holding up the proccessing time?
There could be some small simple code bits holding up your vegetation lod system that you've missed/etc, as I all too well know with these kind of systems.
ent1ty
Competition winner
Posts: 1106
Joined: Sun Nov 08, 2009 11:09 am

Re: Vegetation loader

Post by ent1ty »

Don't get confused, that's just the old rascal erus trolling hard :)

(well done btw ;) )
irrRenderer 1.0
Height2Normal v. 2.1 - convert height maps to normal maps

Step back! I have a void pointer, and I'm not afraid to use it!
RdR
Competition winner
Posts: 273
Joined: Tue Mar 29, 2011 2:58 pm
Contact:

Re: Vegetation loader

Post by RdR »

ErUs wrote:I'm not sure what you mean by vegetarian. Is the main character in your game a vegetarian? are you trying to load the player model?
Lol
ACE247 wrote: On a different note, RdR maybe you could outline your algorithm a bit more. Maybe profile it a bit?
Is likely some lookop function, draw call or otherwise holding up the proccessing time?
There could be some small simple code bits holding up your vegetation lod system that you've missed/etc, as I all too well know with these kind of systems.
The algorithm is not the problem, it works good and only creates vegetation when the map loads.
Problem is the memory its uses. Not when creating it, but when the vegetation is loaded, it uses alot of memory to hold all the vegetation data.
ErUs
Posts: 165
Joined: Thu Oct 07, 2004 6:13 pm

Re: Vegetation loader

Post by ErUs »

Firstly: Are the patches repeating?
If they are then just make the patch smaller.

If not then you could try streaming from disk, but async loading can be a pain with irrlicht.
RdR
Competition winner
Posts: 273
Joined: Tue Mar 29, 2011 2:58 pm
Contact:

Re: Vegetation loader

Post by RdR »

ErUs wrote:Firstly: Are the patches repeating?
If they are then just make the patch smaller.

If not then you could try streaming from disk, but async loading can be a pain with irrlicht.
Patches are not repeating because they are unique, but plant meshes are repeated (but rotated / scaled a bit)
If i make the patch size smaller, this means I need more PatchSceneNodes to cover the world.
And results in the same memory, because the same plants are used.
hendu
Posts: 2600
Joined: Sat Dec 18, 2010 12:53 pm

Re: Vegetation loader

Post by hendu »

You're right that instancing would solve this issue. With no cpu-side batching, the naive implementation would be one draw call per plant.

Just curious, what memory and how much?


T@w is very close to looking better than scorched3d, btw ;)
ACE247
Posts: 704
Joined: Tue Mar 16, 2010 12:31 am

Re: Vegetation loader

Post by ACE247 »

T@W is quite similar to Zero Ballistics actaully, but better. :)
Except, the Environment scaling in T@W is a 'bit' of... Trees are so unrealistically huge...
RdR
Competition winner
Posts: 273
Joined: Tue Mar 29, 2011 2:58 pm
Contact:

Re: Vegetation loader

Post by RdR »

hendu wrote:You're right that instancing would solve this issue. With no cpu-side batching, the naive implementation would be one draw call per plant.

Just curious, what memory and how much?


T@w is very close to looking better than scorched3d, btw ;)
Yep, thats why I PMed ;) So far only good solution I found to solve this problem.
Memory depends on how much vegetation there is in the world/map.
In the free hills map its ~500MB extra memory for the vegetation (no trees)

Not familiar with scorched3d but will check it out :D
ACE247 wrote:T@W is quite similar to Zero Ballistics actaully, but better. :)
Except, the Environment scaling in T@W is a 'bit' of... Trees are so unrealistically huge...
Thanks!
Hmm wil look into that, some more improvements or suggestions (for T@W or this topic)?
Virion
Competition winner
Posts: 2148
Joined: Mon Dec 18, 2006 5:04 am

Re: Vegetation loader

Post by Virion »

I think instancing could probably save up a lot of memory while maintaining good performance. correct me if i'm wrong.
ACE247
Posts: 704
Joined: Tue Mar 16, 2010 12:31 am

Re: Vegetation loader

Post by ACE247 »

Instancing is definetly the way to go.
I thought you already had that, RdR? Any good veg manager will need it...
RdR
Competition winner
Posts: 273
Joined: Tue Mar 29, 2011 2:58 pm
Contact:

Re: Vegetation loader

Post by RdR »

ACE247 wrote:Instancing is definetly the way to go.
I thought you already had that, RdR? Any good veg manager will need it...
No, dont have it yet :(
Does anyone got a good Instancing example with Irrlicht?
Or give me some pointers?


Image
hendu
Posts: 2600
Joined: Sat Dec 18, 2010 12:53 pm

Re: Vegetation loader

Post by hendu »

Well, start with my old hack, figure out how to nicely add instanced arrays to irr api, and implement DX parts too if you want those ;)
Post Reply