Sign in to follow this  

real time grass

This topic is 676 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello, I have some basic questions about real time grass rendering.

 

1.Assume that I have a flat area that I want to fill with grass. How should i calculate position and distance, what should be the density ?

 

2.Is the grass should be rotated in the direction of the camera ?

 

3.Should I use instancing ?

 

It's a start , I am counting on the support , I read a lot of articles but none responded fully to these questions .

Edited by widmowyfox

Share this post


Link to post
Share on other sites

1.Assume that I have a flat area that I want to fill with grass. How should i calculate position and distance, what should be the density ?

I'm not sure about this so I can't help you off the top of my head.

 

 


2.Is the grass should be rotated in the direction of the camera ?

Grass quads have been known to criss-cross each other so yes but not necessarily parallel to the camera.

edit2 - I don't know why I said yes... I meant no... because you criss-cross quads.  But I think it really depends on exactly how you are 'handling' grass rendering.  I'll look for the papers/articles that I was referencing with my memory, if I find them I'll post them.

 


3.Should I use instantiating ?

From what I've read most foliage systems use instancing.

edit - but I've not seen anything explicitly for grass.  You could also use dynamic index buffers (i think).(you can use dynamic vertex buffers as well.)

Edited by Infinisearch

Share this post


Link to post
Share on other sites

Have you searched here yet?  

 

http://www.gamedev.net/topic/645080-good-way-to-manage-grass-rendering/, which leads to a good article specifically on grass rendering here: http://www.kevinboulanger.net/grass.html (which a few other posts actually link to as well).

 

GPU Gems 1 apparently has a good section on grass rendering too.

Share this post


Link to post
Share on other sites

There's no mathematically best way to make nice looking grass. It depends on biome/environment, art style, desired tone, palette, etc. If you randomize the rotation it will look different than if you don't, but there's no reason to say one is objectively better than the other. Try both and see what you like. 

 


3.Should I use instancing ?

 

If you're rendering a lot of things you should minimize your draw calls. This doesn't necessarily mean you need to use instancing -- you could bundle patches of grass together for example. Or use instancing too. There's all sorts of ways really.

Share this post


Link to post
Share on other sites

In caveman v3.0, different types of grass are implemented different ways.

 

for sparse scrub grass, grass is placed via a "plant map". a plant map is a map of a 800x800 foot area of the world, implemented as a sparse matrix, containing 1300 plants. so there are 1300 clumps of scrub grass in an 800x800 foot area. location is random, as is size, rotation, mesh, and texture. height is determined by calling the heightmap function with the location of the plant. 

 

for dense grass such as prairie or tall grass, grass is placed every 4 feet or so, with random jitter to the location, and random scale, rotation, mesh, and texture. 

 

plant maps are generated once at new game start. they are tiled across the world to define the location of every plant in the game. the game world size is 2500x2500 miles.

 

plant map size is selected large enough so that no moirre' patterns from tiling are noticeable, IE a little bigger than max visual range.

 

plant maps are save and loaded with the savegame, so plants don't suddenly move.

 

i can draw about 15,000 plants with dx9 fixed function, no instancing, no LOD, no imposters, on a low end PC. i'm currently drawing grass at full resolution out to about 1000 feet (~300 meters).  and that can just as easily be swaying grass. just haven't added the code yet to change the rotation over time.

 

one trick to drawing lots of grass is low poly models. a few simple quads with their tops twisted in relation to their bottoms works amazingly well.

 

good models and textures are the key to good looking results.

Share this post


Link to post
Share on other sites


i can draw about 15,000 plants with dx9 fixed function, no instancing, no LOD, no imposters, on a low end PC.

How many draw calls does that 15,000 plants get drawn in?  Also are you using texture atlases?  Also are you pre-transforming vertices?

Share this post


Link to post
Share on other sites

This topic is 676 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this