I’m trying to make a nice looking forest to a new game im working on. But theres a problem with the rendering of my shaders. I have it currently setup to render close by trees with an 2d-sprite renderer. And the other trees that arent close enough will get render using the shader instead. But the problem is with the trees that are using the shader. Cause when i look at them and move my camera up they just stop rendering… why?
The objects get frustum culled. The culling is done on the bounding box of the object.
You’re adjusting the vertices in the shader so they fall outside the original bounding box. This means the culling process can sometimes assume they are invisible, while they actually are visible.
The solution is to match the bounding box with the actual maximum displacement in the vertex shader.
I found a solution. I created a new quad-gameObject. Added a new scripts and added this to the Start() method and that seems to have fixed it. transform.GetChild(0).GetComponent().sharedMesh.bounds = new Bounds(new Vector3(0, 0, 0), new Vector3(1, 1,1) * 10.0f);