Me and a few of my friends (StungaLab) decided to create this animation from last year and I’m responsible for all Unity things – setup / shaders / tools / plug-ins etc. I didn’t help a lot as I have my full-time job in UK so most of the work are actually done by the 2 amazing 3D artists Felix Yin-Zhen Chu and Shadow Chi-Ho Wong, also 2D part by Carol Tsz-Ching Ng. It is the first time for us all to put ourselves into such a big production — target at high quality, massive amounts of assets, and short time-frame,
(esp. ) lack of knowledge of using Unity (they are almost the first time Unity user). The final animation really surprised me.
I only have mobile game development experience in the past so there was no way for me to grab so many plug-ins and use so many expensive graphics features in any projects. So I had no idea how to correctly set things up for a project like this. Glad that I work in Unity and the knowledge I gained supported me a good start.
Note: Not everything shown in this blog are being used. But they are the stuff I worked on so I hope to keep them here as a log.
(3D by StungaLab)
Some hints / notes from devs when using SRP APIs
- ONLY use the cameras passed to the function rather than using `Camera.main`
RenderStateBlock rsb = new RenderStateBlock(RenderStateMask.Depth | RenderStateMask.Blend);
- This will call the correct constructor for RenderStateBlock, which initializes everything to the correct defaults _and_ sets the mask a bit more conveniently.
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.
Originally I have in
_floatArray = new float; _floatArray = 1f; _floatArray = 0.5f;
And use ComputeShader.SetFloats() to pass the values from C# to Compute Shader.
Reading the values in Compute Shader, I found that only FloatArray has the value. So FloatArray will equals to 0.
Unity dev (Marton E.) replied me that: