✔️ Works in 2020.1 ➕ 2020.2 ➕ 2020.3
🩹 Fixes:
► Make sure your source mesh has read/write enabled in it's asset importer inspector.
Grass is a tough thing to render for any game. I've shown two ways to do it, and here's a third approach! This uses a compute shader to extrude a blade of grass from each triangle on a source mesh. The blades dynamically simplify when far from the camera, helping you to create large fields, and wave with the wind too.
👋 Subscribe for weekly game development videos!
https://www.youtube.com/c/nedmakesgam...
👑 Join my Patreon for extra influence over topics, early access to videos, and downloadable project files!
► / nedmakesgames
🔗 Check out my website for a searchable list of tutorials!
► https://nedmakesgames.github.io
🔴 Twitch ► / nedmakesgames
🐦 Twitter ► / nedmakesgames
🎮 Discord ► https://discordapp.com/invite/ubxSVBK
📸 Instagram ► / nedmakesgames
👽 Reddit ► / nedmakesgames
🎶 TikTok ► / nedmakesgames
☕ Ko-fi ► https://ko-fi.com/nedmakesgames
🎬 Previous videos
► Compute shader basics: • Intro to Compute Shaders in Unity URP! Rep...
► Cross-mesh grass in shader graph: • Wind Animated Grass In Unity URP Shader Gr...
► Geometry shader layered grass: • Rendering Grass In Unity URP Using Noise a...
► Compute shader layered grass: • Endless Fields of Grass in URP with a Comp...
✨Follow up videos
► Trample effects on cross mesh grass: • Trampled Grass! Add Simple Interaction to ...
► Improved blade grass: • Blade Grass! Generate and Bake a Field Mes...
📜 Required scripts
► NMGGrassBladeComputeHelpers.hlsl: https://gist.github.com/NedMakesGames...
► NMGGrassBladeGraphicsHelpers.hlsl: https://gist.github.com/NedMakesGames...
📚 Reference scripts
► Base: https://gist.github.com/NedMakesGames...
► Randomization: https://gist.github.com/NedMakesGames...
► Segments: https://gist.github.com/NedMakesGames...
► Wind: https://gist.github.com/NedMakesGames...
► Instantiation: https://gist.github.com/NedMakesGames...
► LOD: https://gist.github.com/NedMakesGames...
⏲️ Timestamps:
0:00 Intro
0:44 Project setup
1:30 Base scripts
10:34 Randomization
12:48 Segments
15:54 Wind
18:26 Instantiation
19:17 LOD
20:58 Wrap up and credits
🎖️ Credits and references:
• Roystan: Grass Shader - https://roystan.net/articles/grass-sh...
• CJT-Jackson: URP Geometry Shader Example - https://github.com/CJT-Jackton/URP-Ge...
• Keijiro Takahashi: AngleAxis3x3 - https://gist.github.com/keijiro/ee439...
• Ronja Böhringer: White Noise - https://www.ronja-tutorials.com/2018/...
• Siddharth Hegde: Messing with Tangent Space - https://www.gamasutra.com/view/featur...
• freepik: Wrinkled paper texture - https://www.freepik.com/premium-vecto...
• benblo: TransformBounds - https://answers.unity.com/questions/3...
• DuncanF - Lockless marching cubes with DrawProceduralIndirect - https://gist.github.com/DuncanF/35350...
• Kevin Hartnell: music "The 13th Nocturne" - https://freemusicarchive.org/music/Ke...
#GameDev #IndieDev #Unity