Live data from Hacker News

WebGL Fluid Simulation

paveldogreat.github.io

41–50 of 61 posts

Re: WebGL Fluid Simulation

#41

I have a fork of this that inverts the light model from additive to subtractive and suddenly its like ink in water https://observablehq.com/@tomlarkworthy/ink

This was the first thing I did when I wrote a fluid sim as well - I’ve spent a ton of time and energy pursuing ways to get subtractive color effects (the richness and light-subjectivity of pigment) in digital artifacts and have mostly come up empty, but I take every chance I can get.

Have you checked out mixbox[0]? The outputs do feel intuitively "right" as someone who has dabbled in watercolor, and the paper/videos cover the thinking and Kubelka-Munk theory well.

[0] https://github.com/scrtwpns/mixbox

Re: WebGL Fluid Simulation

#43
Can someone explain what kind of fluid this is simulating? Obviously it implements the general Navier-Stokes fluid equations, but if I twirl some ink in a cup of water it looks nothing like this so I'm confused by the naming.

Is it a scale issue? When I look at the sea it doesn't look much like this either, so I don't think so?

Is there a combination of parameters I could set in the simulation such that it looks like what I see when I pour myself a glass of water, or watch waves at the beach?

Or is it because all the real world examples I'm referencing are 3D, and this is 2d?

Re: WebGL Fluid Simulation

#45

I have a fork of this that inverts the light model from additive to subtractive and suddenly its like ink in water https://observablehq.com/@tomlarkworthy/ink

How difficult would it be to prevent the ink from disappearing? Any tips would be appreciated, I'd love to integrate this into a drawing app.

very easy, its a free parameter in the simulation see the "Ink dissipation" slider, you can set it to > 1 for some weird effects.

Re: WebGL Fluid Simulation

#46
post #41

Earlier quoted context omitted.

This was the first thing I did when I wrote a fluid sim as well - I’ve spent a ton of time and energy pursuing ways to get subtractive color effects (the richness and light-subjectivity of pigment) in digital artifacts and have mostly come up empty, but I take every chance I can get.

Have you checked out mixbox[0]? The outputs do feel intuitively "right" as someone who has dabbled in watercolor, and the paper/videos cover the thinking and Kubelka-Munk theory well. [0] https://github.com/scrtwpns/mixbox

oh wow, they have the fluid demo too!!! Thats so much better!

https://scrtwpns.com/mixbox/fluids/

Re: WebGL Fluid Simulation

#47
post #43

Can someone explain what kind of fluid this is simulating? Obviously it implements the general Navier-Stokes fluid equations, but if I twirl some ink in a cup of water it looks nothing like this so I'm confused by the naming. Is it a scale issue? When I look at the sea it doesn't look much like this either, so I don't think so? Is there a combination of parameters I could set in the simulation such that it looks like…

It should look basically accurate, except that the edges absorb momentum. You're looking downward into a pool of water and dragging the mouse is like dragging a finger through the water. Not totally the same, because the mouse is directly imparting momentum into the fluid instead of displacing it- that's why twirling looks wrong. If you move the mouse in a circle it will constantly grab and pull back the fluid, which can't be done in real life.

The fluid has a set lifetime instead of actually mixing, which makes it look different- normally the edges would dissipate faster than the areas that are all ink but instead it just all fades at the same rate.

The simulation is kind of 3d- since it's incompressible, pressure at any point is proportional to the height of the fluid. Advection still happens on a single plane, but if the pressure-related height is relatively large compared to the average depth of the fluid it's not a bad approximation. The viscous losses are also kind of arbitrary, but it's not far from water.

Re: WebGL Fluid Simulation

#48
post #41

Earlier quoted context omitted.

This was the first thing I did when I wrote a fluid sim as well - I’ve spent a ton of time and energy pursuing ways to get subtractive color effects (the richness and light-subjectivity of pigment) in digital artifacts and have mostly come up empty, but I take every chance I can get.

Have you checked out mixbox[0]? The outputs do feel intuitively "right" as someone who has dabbled in watercolor, and the paper/videos cover the thinking and Kubelka-Munk theory well. [0] https://github.com/scrtwpns/mixbox

Wild! Just saw that at the top of the front page and thought ‘dang is HN reading my mind today??’

Thanks for the link!

Re: WebGL Fluid Simulation

#50
post #14

I think this actually produces HDR on my iPhone 15 Pro, which really makes it pop because not a lot of things do Very cool!

It looks really nice and is very smooth.. But a subscription for a fluid dynamic app, really?

People will fall over themselves to attach a subscription to anything. Pure cancer if you ask me.
Post reply on HN