Container Water 06: Leaving ShaderGraph behind

If this is your first exposure to this series of posts about the “Container Water”, you’ll not “heard” me moaning about ShaderGraph. Well, over my travels, I’ve been getting progressively more frustrated at the speed in which ShaderGraph allows me to work.

This post is a slight departure from the rest of the series as I want to record some of my techniques from moving back to HLSL from ShaderGraph, in the hope that others will find it useful until Unity catch up.

Container Water 05: The new Normal

I didn’t want to age any of these posts my making 2020 references, but for an article about creating new normals… I couldn’t help it.

I just wandered through the process of putting together the first iteration of the fluid shader, but I was not happy with how the recalculated surface normals had turned out using ShaderGraph’s “Normal from heightmap” node. Vertex deformation in shaders wasn’t exactly new to me, however I’d not needed to re-compute the surface normals before – previous modifications hadn’t been drastic enough, so time to get my hands dirty-er.

Container Water 04: Creating the “First” Shader

Now that we have the two main visual foundations of this effect ready (the general shape, and the surface sim), it’s time to put them together in a shader. As I am Fish is the studio’s first project using Unity’s HD Render Pipeline, this is going to be an interesting experience, and my first real foray into Shader Graph.

Spoilers, I’m not a fan so far.

Container Water 03: 2D Surface Sim

With the water constrained into the bowl, I’ll now move onto the surface simulation. Here I wanted something more than sine waves for the surface of my water sim, mainly because our fish inside the bowl ideally want to interact with the water’s surface.

Damoiseaux described in his breakdown how he had used a spring system to simulate physics for the surface of his water, it’s something I’d never done before, but had been assured by the code lead at the time it was straight forward enough an algorithm.

Container Water 02: Constraining the water to the bowl

As I found in the last post in this series, just pushing verts down to the water’s surface comes with an immediate issue (as seen above in the featured image).

The verts very quickly fall outside of the original volume, which breaks the effect. Now if it was a sphere, we could mitigate this by not reducing the water level below the half-way mark, but this doesn’t help if our simulation wants to displace water beyond this. So we need a solution.

Container Water 01: Flattening the surface

This is the second post (See the first here) in the my “Container Water” series where I’ll be going step by step (more-or-less) into how I’ve approached the creation of this effect for I am Fish. This post goes into detail about where I started with this effect, and at the time of writing the whole system is still heavily WIP.

Container Water 00: Experiments in pseudo-fluid bottle simulations for Unity

As is the case for a number of Generalist Tech Artists out there, we tend to need to know – or learn – a lot of different things. Often we become proficient specifically at the tasks each different game sets us, and the current game I’m working on is quite exciting for this reason.

I am Fish is a sequel to I am Bread – a game I enjoyed working on, and still remember fondly – which now sees you as a fish, navigating a dangerous human world in search of the sea and your freedom.