- Home /
I need swaying, self-shadowing, ultra-realistic grass
I'm making a game where the player needs to look through a field of tall grass (like 5 feet tall) at night with a flashlight, using clues like moving grass and binaural sound. What's the best way to create a field of grass that has these features?
Casts shadows from a dynamic spotlight that can shadow itself
Sways gently in the breeze
Flattens or bends out of the way when a kinematic physics object (or wind zone) moves through it
Looks realistic up close
Has thin, tall blades of grass but must be dense enough to hide something in it
Does not need to work with Terrain
I've been looking everywhere. The best I can do is procedurally spawned 3D meshes of chunks of grass with a collider trigger and animator to handle the movement, but I can't fill a meadow with these without them either being unbelievably chunky or tanking the framerate. I made better looking results with a SpeedTree clump of grass but the SpeedTree shader doesn't allow self-shadowing, and I haven't yet experimented with wind zones to see if that works to flatten the grass realistically.
Maybe before I spend another week working on one solution that turns out to be a dead end can someone fill me in on what method works the best for all this?
Sounds like your original solution was on the right track. 3D meshes making up a meadow, procedural or not, shouldn't matter. So the problem you encountered was performance issues. $$anonymous$$akes sense, too many complex objects will do that. Considering you are navigating at night, you can probably easily disable features on the grass that are faraway and the player wouldn't even notice. Try taking advantage of LOD and disable components (colliders?) or features (swaying,? shadows, etc) on objects that aren't in the proximity of the player.
Unfortunately all of the grass features are being used even if they are only heard or seen after the fact even if not at the moment, the player still needs to hear if something moves in the grass behind them for instance.
What is it exactly that kills your framerate? Are you doing this on the CPU or the GPU?