Grass rendering performance

Discussion area about developing with Ogre-Next (2.1, 2.2 and beyond)


Lax
Gnoll
Posts: 665
Joined: Mon Aug 06, 2007 12:53 pm
Location: Saarland, Germany
x 64

Grass rendering performance

Post by Lax »

Hi,

I created a vegetation functionality, in which grass is placed over the terra surface.
I thought, that grass which has been created via the flag SCENE_STATIC.
The corresponding nodes have also been created via this flag.
The rendering distance have been set to 50meters.

No I observe dramatically frames drop, as I render up to 20000 grass items. See attached picture:

http://www.lukas-kalinowski.com/Homepag ... /Grass.png

I thought, that all static items in the scene are automatically using instanced functionality?

How can I increase performance? Are there some hints?

Best Regards
Lax

http://www.lukas-kalinowski.com/Homepage/?page_id=1631
Please support Second Earth Technic Base built of Lego bricks for Lego ideas: https://ideas.lego.com/projects/81b9bd1 ... b97b79be62

User avatar
Crystal Hammer
Orc
Posts: 405
Joined: Sat Jun 23, 2007 5:16 pm
x 115

Re: Grass rendering performance

Post by Crystal Hammer »

Hi. I think 20000 items is already big.
In my terrain demo I had about total 100000 trees/rocks etc, with 10000 visible at 70 Fps. But that was so on demo, I drop now below 60 Fps with 7000 total instances in StuntRally3 with more stuff.
This was only for vegetation. It does indeed use instancing automatically. But the more items, the more CPU has to test for culling each frame I think. So best if it too did some paging logic someday for big maps.

The way I did grass (very basic way for now, in StuntRally3) is I created pages of size 150x150 meters with many grass x patches. Works okay for not too big terrains.
I think instancing is gone, it won't work since these are each different meshes. I'm not sure if textures are packed to array and speed up, or just each material (and each page) is anyway a new draw call.
And my grass doesn't cast shadows (on terrain), can only receive.

Lax
Gnoll
Posts: 665
Joined: Mon Aug 06, 2007 12:53 pm
Location: Saarland, Germany
x 64

Re: Grass rendering performance

Post by Lax »

Hi Crystal Hammer,

thanks for some information on that topic.

And my grass doesn't cast shadows (on terrain), can only receive.

I truly forgot to disable shadow casting and that indeed made up a performance boost.

Best Regards
Lax

http://www.lukas-kalinowski.com/Homepage/?page_id=1631
Please support Second Earth Technic Base built of Lego bricks for Lego ideas: https://ideas.lego.com/projects/81b9bd1 ... b97b79be62

Nickak2003
Goblin
Posts: 272
Joined: Thu Jun 10, 2004 4:19 am
x 26

Re: Grass rendering performance

Post by Nickak2003 »

I check if the grass is inside the frustrum and if its not, I set its visibility to false or even unload it, seems to work well.

Lax
Gnoll
Posts: 665
Joined: Mon Aug 06, 2007 12:53 pm
Location: Saarland, Germany
x 64

Re: Grass rendering performance

Post by Lax »

Hi nickak2003,

thanks for the advice.

I have already setRenderDistance set. But I think it will only work ahead of the camera view frustrum.

How can I check if e.g. grass is behind the camera. Because 20000 grass units are rendered?

Do you have a sample code, in order to get the idea?

Best Regards
Lax

http://www.lukas-kalinowski.com/Homepage/?page_id=1631
Please support Second Earth Technic Base built of Lego bricks for Lego ideas: https://ideas.lego.com/projects/81b9bd1 ... b97b79be62