[WIP] Stylized Grass Shader (Universal RP)

I’m working towards a release version of this shader. Currently rewriting it without Shader Graph for maximum efficiency and control. Minimum compatible version is currently set at Unity 2019.3. It is specifically built for the Universal Render Pipeline.

imperturbablejauntybufflehead
fittinggloomybagworm
closedplaintiveblueandgoldmackaw

Store page draft:

Key features
• Lush wind animations
• Per object and per vertex color and wind variation, breaks up visual repetition
• Bending and flattening through trails, objects or particle effects
• Color blending with terrain surface (supports tiled setups and mesh terrains)
• Includes several grass models and textures designed for mass placement.
• Full Vegetation Studio (Pro) integration

Performance
• SRP Batching compatible
• GPU Instancing and Instanced Indirect ready, for use with Vegetation Studio (Pro) or custom renderers.
• Hand-written shader, for optimal efficiency

Compatibility
This shader is designed for the Universal Render Pipeline (7.0.0+) and is not compatible with the built-in or HD render pipeline.

For PC/MAC/Consoles. Mobile, WebGL and VR are not supported.

Limitations
• Not a grass placement/population tool (docs include tips)
• Does not work with Unity terrain’s vegetation system (outdated)
• Not suitable for static batching (breaks per-object randomization)
• Color blending feature requires a texture to be baked so has limited compatibility with huge or runtime generated landscapes.

3 Likes

Added a wind gusting effect that locally increases the wind strength and adds a light color tint. Next to terrain color blending, which allows for seamless blending with the terrain surface. There are parameters to control each of these effects.

flashysneakyeasternnewt

4 Likes

Reworked all the grass bending features, this can done through meshes, trails or particle effects. I’ll be sure to include a demo scene which showcases this.

Unlike my previous iteration, trails now also bend the grass forwards. And benders hovering over the grass no longer affect it, until they enter the grass. This means you can jump without the grass bending underneath you anyway.

goldenexaltedlamprey

1 Like

Added a translucency feature, this simulates light diffusing as it passes through the grass blades. It’s also being masked in shadows

It may sound complex, but it is a rather simple shader operation with a lot of visual gain!

gregariousquaintbanteng

3 Likes

When will this asset be released to the store ?

I’m aiming to submit it by the end of October (+review process generally takes 4 weeks). The shader features are all there, except for specularity. The documentation is mostly in place, but I still need to tidy up all the scripts/workflow and polish the UI.

3 Likes

Thanks for the updates @StaggartCreations , I wasn’t aware that you already had a thread for this. I have a question about the grass bending/collision, will this be possible through Visual Studio Pro? I know he has his own touch react system but I’d much rather work with your setup.

Thank you for your interest. The package has it’s own system to translate objects such as meshes, trails or particles to grass bending. So it won’t make use of Vegetation Studio’s touch-bend system.

2 Likes

Alright, I’m a buyer as soon as it is ready!

Good job!

1 Like

Will it come with another shader for the rest of the foliage and trees? I would love ot be able to use both your FAE’s asset and this grass on our upcoming release.

This package will only focus specifically on grass, it’s also usable with flowers and plants but the bending has to be subtle, especially for meshes such a ferns. FAE shaders will be converted to URP after I get this out of the door.

I’ve had a bit of a data loss disaster so unfortunately my progress was pushed back. But the final stretch includes the bending script components, documentation and demo scene.

1 Like

Thanks you for the fast reply. I will make sure I can convert entirely to URP and if that the case I will do the switch!

Had a few setbacks with Unity bugs, having to track down issues and build workarounds. I suppose this is to be expected since URP is fresh out of the box. There is also a bug present with TrailRenderers that causes Unity to crash, yay. Meshes on the other hand, work perfectly.

Added features:

  • Bend area masking. Smoothly decrease the bend strength for benders at the edge of the bending area (This is a box that follows the camera or player)
  • Support for Vegetation Studio Instanced Indirect
  • Support for Nature Renderer wind
  • SRP Batching compatibility

The shader now also has two lighting modes (Simple/Advanced). This is akin to using the Simple Lit or Lit URP materials and supports the same features. This is useful when you’re doing a PBR or non-PBR project.

Focusing on creating a decent looking showcase scene now, with accompanying screenshots and video. In the future I’ll be adding Shader Graph nodes, allowing you to create a custom grass shader in a jiffy.

2 Likes

Thanks for the update, @StaggartCreations ! Anticipating the package, my game has felt very empty since I lost vegetation in the transition to URP.

this looks nice, but i don’t think grass should bend into ground by simply something small like objects/creatures just walked over it, try to include a script or something to allow only heavy objects to bend grass only.

Thanks for the feedback! The Grass Bender script has a strength and height offset slider, next to flatten and pushing strength parameters. These can be set per individual object, so should provide ample control over how objects affect the grass. For demonstration purposes, a little exaggeration is needed :wink:

1 Like

Package has been submitted! If all goes well,it should be live some time in January. Documentation can already be viewed here: Stylized Grass Shader Documentation - Staggart Creations

Will consider this WIP thread closed and will open a support thread once I’ve made more screenshots.

Edit: New thread can be found here: Stylized Grass Shader [URP] ☘️ - Community Showcases - Unity Discussions

2 Likes