Liquid Rig in bottles for game engine?

Hope some of you savvy TD’s could lend some suggestions/tips. I’ve been tasked with creating some rigs for our game that entail liquid in both glasses and bottles. Some of these bottles are cylindrical, boxed shaped and oblong. It needs to handle some extreme poses like tipping 90+ degrees. The pouring will be handled with FX. The brutal ones are bottles with a tapered neck. I can do joints or blendshapes but getting any decent shape and have it act liquidy is not an easy task. Hand sculpting a series of blendshapes is tedious and will only handle certain angles.

Any tips would be great!

Well, voxels with collision, runtime booleans and a bunch of other stuff are probably out of the question.

Perhaps you could automate the creation of a series of liquid behaviors inside bottles using an automated boolean script and then take the results and shrinkwrap a mesh to the ugly boolean results. That way you end up with a morph/blendshape-able mesh without having to hand edit each target. Add a liquidy looking shader to the results and you’re GTG.

Thanks for the tip. Not sure if the shrinkwrap will work during the transitions but I’ll give it a shot. My first rig worked out since the glass was round and only had to deform the first row of verts. Taped geo makes it a challenge.

Do you have control over the shader? This seems like something you could do with depth masking.

The liquid is a plane (or, maybe a ripply-plane) parallel to the ground. It will render only over the back faces of the bottle, but not over front faces below cutoff line. So render out back face depth, the plane itself, and the front face depth into 3 targets.

(a) Mask the liquid by the back faces, so it only renders in front of the bottle’s back faces
(b) mask front faces of the bottle by the liquid, so you can tell ‘liquid in the bottle’ from ‘liquid in front of the bottle’
© what you actually want to render is the pixels common to (a) and (b)

Hi Steve,
I do have control over the shader however I’ve had no experience in writing one. I understand what you’re saying and I’ll have to see if our engine will support this feature. This masking approach has been something I’ve been wanting for other items for our character pipe so would be worth investigating further. The key would be that this could be animated and visible in Maya as well as the engine. So if the liquid filled the bottle and had a joint or transform that determined the direction of the mask and any geometry above the plane would be masked out could fake the tipping and level of the liquid. Thanks for the suggestion. If I can’t get our shader to support this any other possible solution?

The shader solution would probably the most runtime friendly, since all the other options involve pretty arbitrary geometry modifications at runtime. I’m pretty sure this would be doable in Unreal or Unity – it’s not that different from the tricks used to generate highlighted outlines around 3d objects

I’d love to say we’re using either engine :frowning:
I put in a request and specs to our rendering team to basically create an orthogonal clipping plane shader that lets me define an axis of clipping that could be driven by an xform. Hope it works. Otherwise I’ll be sculpting a crap ton of blendshapes.