Hacker News new | ask | show | jobs
by croemer 901 days ago
As a trained physicist, it's weird to see such "unnatural", ad hoc fields used. I have the feeling that using a fluid dynamics solver might generate more realistic looking fields. One issue with the smoothing is that it introduces a discontinuous correlation function. When you crank down smoothing, you can see this artifact as horizontal lines that get closer and closer together as smoothing is lowered. Simulated fluid flow with a few sources, sinks would mean there's no need for ad hoc smoothing.
3 comments

Been a while since I dabbled with fluid physics, but I was thinking how about ensuring the input noise field was divergence free[2]?

[1]: https://en.wikipedia.org/wiki/Projection_method_(fluid_dynam...

Yes! A friend and I had the same thought a while back and then remembered the curl operator from vector calculus is divergence free, so you can take the curl of any 3d field to get a divergence free result, and then use a 2d slice of that if you want. It does look like fluid flow when you do that. I’ve even used this trick in CG films back when I worked at DreamWorks. We wrote a bit about this divergence free noise field fake fluid flow in a Siggraph course. A few years later, another researcher came up with some techniques for putting boundaries and obstacles into the noise field. He may have come up with the same idea for using the curl of noise independently, but he referenced the article my friend and I wrote. https://www.cs.ubc.ca/~rbridson/docs/bridson-siggraph2007-cu...

But! I’m not sure divergence free noise would necessarily solve any problems for what this artist is trying to achieve. The art he’s generating is currently making use of the field’s divergence and convergence properties; in the images it’s important that lines move further apart and become less dense sometimes, and then converge and become more dense in other places. The divergence can be ugly if you see too much of it or identify the pattern, and that’s a big reason the article uses collision detection to terminate converging lines. But the finished images he shows are also setting the noise scale and framing the image manually in order to maximize the benefits of the divergent noise, and minimize the downsides.

When I googled for the paper I found a few interesting links about curl noise:

2d example: https://al-ro.github.io/projects/curl/

3d example: https://al-ro.github.io/projects/embers/

Houdini offers curl noise. Houdini is amazing for generative art, btw, and has a free personal learning edition.

Docs: https://www.sidefx.com/docs/houdini/nodes/vop/curlnoise.html

Example usage: https://entagma.com/houdini-curl-noise-flow/

Very interesting, thanks for sharing.

I get that a perfectly divergence-free field might not be what the artist is after, but if you go the projection route where you "subtract out the divergence" so to speak, I was thinking you could just do a scaled subtraction to not take all of it out. Alternatively perhaps it could be artistically interesting to do a non-linear scaling.

Anyway, seems like a fun rabbit hole.

First rule of computer graphics: simple and plausible beats complex and realistic, every time. A noise function you likely have anyway, as noise has a myriad uses in graphics. An FD solver, not so much, at least if you're not working on water/smoke/fire simulations.
I love simple and plausible over complex, but there is a consistent trend over time in CG of adopting the realistic simulation approaches as we tame them. See my sibling comment about curl noise for examples of fake fluid flow, but I have to caveat that writing a simple fluid solver for generative art is pretty easy and a lot less demanding than for simulation or production work. A fluid solver is also, interestingly, less compute than Perlin or simplex noise. Those noise functions are quite expensive to evaluate at a point, compared to the amount of math needed to process fluid for a voxel’s timestep (I’m talking 1-2 orders of magnitude). You can amortize the noise cost if it’s static and you sample it onto a grid, but otherwise, surprisingly, it’s possible for noise to be a more complex and less plausible choice, depending on what the artist wants.
Why should the fields be realistic looking? I guess this is one of the dangers of presenting working interactive illustrations and tutorials for generative art; it lets people look behind the curtain and identify the illusion, and you lose the magic of the finished artwork. The artist was careful and deliberate in their final examples to not crank down the smoothing enough to see horizontal lines. Simulated fluid flow wouldn’t be able to easily produce any of the first three images in the article very easily, if at all, and people doing simulated fluid flows still frequently inject turbulence (ad hoc noise) anyway in order to give it texture.