Change "liquid" level in glass container

I’ve assembled two game objects, one inside the other. I’ve given the outer object a glass-looking material, and the internal object a solid material

Assuming I don’t care about liquid physics or gravity, how would I change how much of the internal material I render?

I’ve got a percentage in code that I can easily reference, so assuming I give it a 50% value, I want the interior to only render half of that “liquid” starting from the bottom of the object.

Can someone help by telling me what I’ll need in order to dynamically change the level inside?
I can’t find what I need to crack this case. It doesn’t help that I know very little about Materials, rendering, shaders, etc.

I found a video that has a demo of what I want to do. I just don’t know how to get started.

1 Like

You’d need to know shader programming to do what’s in that video. It may also be possible with Shadergraph, if you’re using an SRP.

You might try googling to see if anyone has already done it and is giving it away free, for example:

I did see that, but I thought it was only for the wobbling effect. I see the shader code for it. It looks promising. I appreciate that!

It looks like the wobbling aspect is controlled by the C# script rather than the shader, so you might be able to exclude that specific portion without making major changes.

That vid was sick. Amazing!