real time grass

Started by
8 comments, last by Infinisearch 8 years, 2 months ago

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 .

Advertisement

Really, no one? Please, my main question is:

How to calculate position of every piece of grass to make it look natural ?

Linear random generator for x,y and z from heightmap? You could also add random rotation and scale.


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.)

-potential energy is easily made kinetic-

What about slope? How can I ganerate grass on uneven surfaces?

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.

I read all of these but as i said there are not answer to my questions :/ Does blade locactions, size, rotation is randomized?

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.

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.

Norm Barrows

Rockland Software Productions

"Building PC games since 1989"

rocklandsoftware.net

PLAY CAVEMAN NOW!

http://rocklandsoftware.net/beta.php


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?

-potential energy is easily made kinetic-

This topic is closed to new replies.

Advertisement