Interactive Bottled Liquid Material (Unity)   More Details
An interactive, deceptive bottled liquid shader created in Unity URP. The liquid dynamically responds to the bottle motion, simulating wobbling and waves, and features refraction and reflection.

Wobble, Waves, and Clipping
  • Wobble: Vertices rotated around the x and z axes relative to the liquid’s origin. Adjusted direction vectors simulate the liquid’s tilt and wobble dynamically.
  • Waves: Intersecting wave patterns were created using sine functions applied to the wobble-adjusted direction vectors.
  • Clipping: A step node compared the y component of the unit direction vector against a fill level parameter, which was remapped from 0~1 to -1~1, for alpha clipping to create the desired liquid level.
Side Surface
  • Refraction: Screen-space sampling with offsets based on view direction and normal vectors, combined with Gaussian blur, created realistic refraction.
  • Parallax Effect: Simulated floating particles inside the liquid by calculating virtual refraction directions for UV offsets, creating a realistic depth effect.
  • Fresnel: Fresnel reflection was blended with liquid color for edge effect.
Top Surface (Main Challenge)
  • Projected Surface: Backface vertices were projected onto the liquid surface based on wobbling and fill level.
  • Normal Disturbance: Wave-induced normal variations were calculated to add surface dynamics.
  • Floating Particles: Simulated particles rising and falling with the liquid surface by  sampling with perturbed UVs .
  • Reflection: Captured dynamic reflection effects using a reflection probe, based on normal changes; adjusted probe position in real time via script to synchronize with the liquid's displacement.
Output Switching
  • Side and top surface effects were conditionally output based on face direction using Switch by Face, with alpha clipping applied for surface level.
©Shijia Liu
Technical  Art
Fantasyland