All projects

Unity · Virtual Reality · Personal

VR Koi Pond

Work in progress

Koi fish pond built in Unity for a Virtual Environment. Koi fish responsively detect and avoid walls, seek out food, and reproduce. Koi fish offspring inherit the colors of their parents.

  • Unity
  • C#
  • VR
  • Amplify Shader Editor
Illustration of two koi fish swimming among cherry blossoms

01 Behavior

Event triggers

The koi fish have gravity applied upon leaving the water, and taken off when entering back into the water.

Swimming

The koi fish will reorient themselves to face upright when being put back into water.

Wall avoidance

The koi will avoid running into walls. This will be expanded upon in the future to give them multiple actions they can take upon first detecting a wall. For now they will just turn away from it.

02 Interaction

Food

Spawn in food that can be given to the fish. Food gains gravity when dropped, and has a simple function to float when thrown into the water.

Feeding & growth

Feed the koi and watch them grow. Koi will grow to a max size, which will then allow them to have offspring.

Swap koi

Don't like the colors of one of the koi fish? Swap them out for a new koi with randomly generated colors.

Cook koi

Feeling a bit more destructive? Throw the koi into the "fire" and cook them. The spawned in cooked koi will be the same size as the fresh koi was.

03 Shader

The shader is very early on and still a big work in progress, much like everything else. It was built using a node-based shader creation tool called Amplify. The main goals are to give the fish two distinct colors and a pattern that can be altered via property blocks in the C# code, and to give the koi the appearance of wiggling in the water.

Two-tone pattern

Gives the koi a pattern with two distinct colors. Still need to find an alternative to the noise generator, as it is an unoptimized solution to creating a pattern.

Amplify node graph for the two-tone koi texture

Sine-wave wiggle

Manipulates the vertices on the koi based on a sine equation.

Amplify node graph offsetting vertices with a sine wave

World-space movement

Manipulates the vertices on the koi based on the koi's position in the world.

Amplify node graph offsetting vertices by world position

Result

The end result of the shader so far.