Grass Performance Feedback

Started by
15 comments, last by Rainweaver 13 years, 11 months ago
I recently added grass to my game and I would like to hear out some performance results form people with different cards. Here is the link to the game : Download On my machine I get around 200fps but I have a ati 5850.I am wondering how it runs on lower end hardware. You need at least shader model 3.0 DirectX 9.0c. Here are two screenshots : Thanks!
Advertisement
I think you've got a ways to go yet before worrying about performance. I'm currently doing this as a hobby project and have the below with similar hardware requirements:

Grass

The grass in this scene is 2 inches tall and you can have an infinite view - this one is close in because I've been testing the depth and painting aspects. Minimum fps I'm getting from a Radeon 4800 is ~120. The scene above gives ~250fps. Not finished yet but am happy to answer questions...
------------------------------Great Little War Game
Looks great :)

How are you drawing the grass?View aligned sprite,3d models or something else?

I would like to hear how you achieved the effect.Do you get that frame rates with only the grass or other objects on the screen?My map is 256x256 with 1000 objects on it right now.
I changed my grass sprite and looks much better now,here is the result.





I still need to find a way to fix how the model looks when viewed from top though.
Quote:Original post by Black Knight
Looks great :)

How are you drawing the grass?View aligned sprite,3d models or something else?

I would like to hear how you achieved the effect.Do you get that frame rates with only the grass or other objects on the screen?My map is 256x256 with 1000 objects on it right now.
Combination really. I have a single clod of grass model of 4000 verts featuring 500 blades of grass made from 8 faces each. I draw around a thousand of these using instancing.

Next stage is a LOD level using fins whose texture is generated automatically using slices through the high detail model. All of these textures fit on a single sheet so I can then instance several thousand of these lower lods. There is a blending off between the two based on a density parameter that also cuts the pathways out.

Getting the blend between the lods was the hardest part by miles as there is intense mip-mapping being used but the alpha needs to remain fairly high resolution so it doesn't all fill in.

Third LOD out to the horizon relies on a shader that blends between a top down grass texture and whatever I want the ground to look like close up - typically bumpy brown randomness.

As this is all still ongoing, I haven't even optimised the CPU useage yet. Every single clod of grass (0.25 metres square) is stored in a massive array and is visibility/lod tested by hand. When I get near the end, a quad-tree should speed all that up nicely.

My "world" is currently 256x256 metres but that can go fairly infinite once the quad tree gets itself written. The grass is the only thing in the level atm so that's where all my fps goes, but (without trying to cause offense) I don't know how you're managing to draw less models, slower, with a better video card. You are using hardware instancing, right? If not, give it a go - it'll change your life.
------------------------------Great Little War Game
Right now I am not using hardware instancing,I am not sure if it will be trivial to add it to my existing code.Mine is probably running slower because basically each model gets drawn like three times.First into the reflection map,then into the shadow map and then finally on the screen.

I will look into instancing and see how it works.
Yeah, my grass doesn't cast shadows. It's a trivial thing to add (I actually had to remove it deliberately) but there wasn't much benefit casting, though it does receive.

You really should look at instancing though. It's not just a bit of a perf boost - in scenes like yours it'll add a zero to your fps counter. Seriously. Good luck with it and enjoy that falling off your chair moment :)

------------------------------Great Little War Game
For grass rendering I build up large patches of grass on the fly.

I have reserved some space for X grass patches (each grass patch covering a certain quad of terrain) and whenever a new grass patch comes within visible range I create the patch-model on the fly according to the terrain data.

To keep the number of grass patch reservation low, I use a LRU cache, further on I create the grass patches in a secondary thread before I upload it to the grafic card (->vbo). So I can put up to 100 grassmodel into a single grasspatch, including little rocks or other plants of different sizes.

The benefit of this technique is, that you don't need to adjust your rendering code, each patch it just a simple object to be rendered.

Looks awesome Rubicon.
Quote:Original post by Litheon
Looks awesome Rubicon.
Thanks muchly :)

I've moved it on a notch now:

latest build

I'm hoping this provides some inspiration. Might write an artcile on it at some point as this is about the first thing I've done that I'm truly proud of.
------------------------------Great Little War Game

This topic is closed to new replies.

Advertisement