- Home /
Only display a shader at a certain height.
I followed this tutorial for grass https://www.youtube.com/watch?v=cHe7N42zE1k and in the end I drag and drop a shader on a mesh and it makes grass display. I want the grass to only start displaying at a certain height.
In the picture above you can see that grass gets placed underwater from this method. So can you decide where to start a shader depending on height?
Answer by Kona · Aug 29, 2021 at 08:19 PM
There is, what you want to do is to add a value to represent the height limit (compared to world position) from which to draw the grass. Then in your shader you check the world position of each vertex to determine if it's y-position is above or below said value. If the value is below the limit don't draw the grass.
Your answer
![](https://koobas.hobune.stream/wayback/20220613042316im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Slicing a sphere mesh and applying reflection probe data in LWRP 0 Answers
grass on objects 0 Answers
Static batching changes vertex colors? 0 Answers
Replacing a geometry shader with a compute shader. How do I output an arbitrary number of triangles? 0 Answers
I need swaying, self-shadowing, ultra-realistic grass 0 Answers