3 ms·
Half-Life Alyx Update – The Booze Shader [video]
- flumpcakes 6y agoThis seems like magic to me. Granted I'm not a graphics developer, but given my current understanding of shaders (programmable functions that are run on the gpu working on textures/buffers?) I don't know how they interoperate with the physics engine which I would assume is running on the CPU. I would love to see a paper on how they did this!
- dividuum 6y agoHere's some explanation on a similar effect and the surprisingly short shader code: https://www.patreon.com/posts/18245226 https://www.patreon.com/posts/18245226 It was referenced by Matthew here: https://twitter.com/skilful/status/1266494606847340544 https://twitter.com/skilful/status/1266494606847340544
- dx87 6y agoHere's a thread that someone made to explain how they did a similar effect in Godot [1]. [1] https://www.reddit.com/r/godot/comments/guhtfm/my_wip_liquidinbottle_shader_since_this_stuff/ https://www.reddit.com/r/godot/comments/guhtfm/my_wip_liquid...
- Jasper_ 6y agoThe CPU can pass state to the GPU. I imagine that a lot of that state (like the clip plane for the top of the water volume, including the normal which provides the "jiggle") was computed on the CPU, which can be updated by a simple spring model based on the object's velocity, which comes from the physics engine. In general, state like an object's velocity are commonly used for reprojection techniques like those used in temporal AA, so it's common to have around in the graphics system anyway. It's likely the particles and foam density are all computed on the CPU by this model as well. No need to do everything on the GPU.
- CyberDildonics 6y agoThere have actually been simple shaders for liquid inside spheres floating around for a while. If know you won't ever have the water surface actually break up you can start with knowing the surface will always eventually be a flat plane in x and z. From there you will need to make sure the plane is at the right place in y with the orientation and volume of the bottle. This could just be a 1D lookup table on cylindrical bottles since spinning the cylinder around the axis it was swept/lathed won't change anything. There was a square bottle but I'm not sure how tightly the volume is preserved there. The surface deformation might be noise and ramps that oscillate and settle, while the bubbles look like spheres deformed with a simple field like sin waves so they jiggle as they move up. All of this is implicit geometry that can be rendered by raymarching in the shader for the bottle surface. This gives you the refraction, the liquid density falloff and the bubbles. The foam is a cool detail too although I don't think it complicates things too severely. The person in the video mentions that he couldn't get the liquid to penetrate the edges of the bottle, but it is unlikely there is any geometry used except for the bottle. That's my guess in how it is done.
- deleted 6y ago[deleted]