I’m working on a little project for a while – creating an area where you can spawn a bunch of grass. I’ve overcame a major headache when figuring out the GPU instancing for the mesh and the code looks like this:
public class Grass : MonoBehaviour
{
[HideInInspector]
public Mesh mesh;
[HideInInspector]
public List<Matrix4x4> matrices;
[HideInInspector]
public Material material;
private void Update()
{
Graphics.DrawMeshInstanced(mesh, 0, material, matrices);
}
}
Now that I’m done with this part I want to optimize things. Shaders of any kind and me are complete strangers so I’m asking for anyone’s help on writing a compute shader that would work with my code to simulate frustum culling.
Thanks!