Sign in to follow this  
Black Knight

Grass Performance Feedback

Recommended Posts

Black Knight    769
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!

Share this post


Link to post
Share on other sites
rubicondev    296
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...

Share this post


Link to post
Share on other sites
Black Knight    769
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.

Share this post


Link to post
Share on other sites
rubicondev    296
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.

Share this post


Link to post
Share on other sites
Black Knight    769
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.

Share this post


Link to post
Share on other sites
rubicondev    296
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 :)

Share this post


Link to post
Share on other sites
Ashaman73    13715
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.

Share this post


Link to post
Share on other sites
rubicondev    296
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.

Share this post


Link to post
Share on other sites
X Abstract X    109
I thought I'd let you know, I couldn't get the game running. After starting it up and picking my display settings, I got:

Error Message:
Can't add effect file terrain.fx (couldn't get compilation errors)

File: src\DirectX\D3D9Renderer.cpp
Function: STE::D3D9Renderer::addEffect
Line:288
--------
STEngine




I'm Running a GeForce GT 240M.

Share this post


Link to post
Share on other sites
X Abstract X    109
Quote:
Original post by Black Knight
Can you try installing the latest DX9 runtimes?

Also check if your card supports shader model 3.0.


Ah forgot I made this post. My card does support shader model 3.0 and I have DX11 installed.

Share this post


Link to post
Share on other sites
scope    108
i constantly get 60 fps with vsync on. just minor slowdowns when view distance is large.

hardware: radeon X1950 pro

so you can crank up the details if you ask me ;-)

grass could need more randomizing

Share this post


Link to post
Share on other sites
Sign in to follow this