Compute Shaders , flock with instanced meshes + frag/vert
Instead of getting data back from the GPU buffer, we're gonna use this code- Graphics.DrawMeshInstancedIndirect(boidMesh, 0, boidMaterial, bounds, argsBuffer, 0); - to draw instances of a mesh. Note the argsBuffer - this is a new type of buffer, containing arguments. It is defined in the C# script and we're only initialising the first 2 entries of the array that we fill the argsBuffer with. It can actually hold a lot more information, but for this example, we only provide it with the index of the mesh and the number of them we want to draw. Argument Buffers seem to be very specific to this type of instanced mesh drawing in Unity. It doesn't seem easy to find information about them... The compute shader and frag/vert shader are not directly concerned with the argument buffer, it seems that the code above is the only actual reference to the argsBuffer! The compute shader only updates the position/direction of the boids. The frag/vert shader (which is actually a surface shad...