r/howdidtheycodeit • u/darksapra • May 04 '23
Question How did they code the displacement of grass?
Does anyone have another example or a similar video with more explanation of a similar method of using a particle system to do displacement on grass?
The full talk
44
Upvotes
21
u/AdarTan May 04 '23
Tutorial from 2018 on how to interactive grass displacement in Unreal Engine 4.
14
u/ShatBrax May 04 '23
Here is a Unity tutorial. It's a pretty common concept in most engines. I searched "botw interactive grass [engine]" and im sure you'll find it.
UNITY: https://www.youtube.com/watch?v=wbEn3PqX80c
GODOT: https://www.youtube.com/watch?v=z_Q0sA3wE10
2
u/Pandanym May 05 '23
I have a public repo on GitHub with a very simple, unoptimized grass renderer.
https://github.com/Pandanym/GrassExperiments
Every blade of grass remembers its bend value so it retains its form based on the cursor position. If I remade it today I would use a texture to store the bend but it's still a good resource to understand how to pass custom data to a shader and modify it from the GPU.