Using Graphics.DrawMeshInstancedIndirect so that I can calculate the fish positions with compute shader.

The moving tails are just vertex displacements in shader. Rotation are also done in the rendering shader.

Below is the look-at matrix that takes the normalized velocity to be the rotation, and to be the forward axis.

Screen Shot 2018-02-01 at 23.14.24

Next, I used the shader from here to make the fishes reacts to light. Put some post-processing effects and fog to make it looks a bit better. One point to note, the normal has to rotate the same way that the vertices do.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s