- Home /
Grass in Geometry/Compute Shader
So right now I'm building my own grass system. I have a custom shader that does wind animation and responds to the player. I am instantiating the grass at runtime, and using 2 levels of scripts to turn renderers and grass game objects on and off. Basically there is a parent 'area' object that turns all the grass in it off if the player is too far away. If its on, all the grass objects are enabled and each determines if it should be rendered based on its own distance to the player. This keeps my Update calls from soaking up all the cpu time.
But I've seen examples of people doing this all on the gpu, and they all reference geometry shaders. I've been looking around and can find no documentation of these geometry shaders anywhere. I have found some things on compute shaders which seem to be different but I could be wrong.
I'm looking for places I can go read about geometry shaders with the intention of creating a terrain grass shader for my game. Any links are much appreciated.
Thanks!
Answer by tanoshimi · May 08, 2016 at 09:40 AM
This seems like a reasonable introduction: https://takinginitiative.wordpress.com/2011/01/12/directx10-tutorial-9-the-geometry-shader/
And an example shader that uses it: http://forum.unity3d.com/attachments/gs-billboard-shader.40064/
Answer by CorvusGameLab · Apr 11 at 01:25 PM
Hi, i made a grass shader with lots of features like player interaction or placing the grass only on a certain height. If you are interested you can download it here: https://www.youtube.com/watch?v=st-EjyeObEM
Your answer
Follow this Question
Related Questions
how to draw billboards grass with alpha? 0 Answers
Is there a way to get an id of the primitive in a geometry shader? 1 Answer
unity_LightColor[1] and up are 0 with 2 point lights near the object. 0 Answers
Recolor Grass 0 Answers
Custom Terrain Details Shader,Custom Detail Shader In 2019.2 2 Answers