# VDB Analysis (Laplacian, Divergence)

## Recommended Posts

Hello,
please, have you seen a good tutorial or PDF or example of VDB Analysis SOP? I dont understand the practical purpose of these:

- Laplacian
- Divergence

this should help

Edited by 3dome
• 1

##### Share on other sites

Thank you very much Dominik. I have tried to understand the divergence and the most intuitive explanation is this: You and three friends float down a river, each marking a corner of a square. If your square is getting bigger, the river has positive divergence. If it's shrinking, negative divergence. It is sum of the vector components of the gradient. I have also made a small HIP to explore an visualize it. Attached.

As regards the Laplacian, I unfortunately don't understand what it does and where to use it, but I will explore more.

Thank you very much!

divergence.hipnc

##### Share on other sites

Both divergence and laplacian are mathematical stuff, so there should be lots of info if you just google it.

• 1

##### Share on other sites

Gradient, a vector, is the rate of change of a vector in Its x,y and z axis. In other words, the acceleration of a vector in Its 3 directions.

So if you have a vector g(x,y,z) = (3x, y^2, 2z^2)

Its Gradient would be the vector <3,2y,4z>

Divergence, a float, is the magnitude of flow that goes inwards/outwards at one point in space. Positive values represent flow that goes away from the point, negative values for flow that goes towards.

If we use the same vector as above, the divergence would be = 3 + 2y + 4z.

Laplacian is the divergence of the gradient. So you would get the magnitude of acceleration of flow in a point.

With the same vector as above, we'd have to derive It again, and add It's components.

(3,2y,4z) --> (0,2,4) --> = 0+ 2 +4.

It is usually used to help solve partial differential equations... But for houdini, well I'm not too sure. In image processing they use It for edge detection, maybe It could find some same usage on fluids? Else, I quote from Wikipedia "For instance, the net rate at which a chemical dissolved in a fluid moves toward or away from some point is proportional to the Laplacian of the chemical concentration at that point; expressed symbolically, the resulting equation is the diffusion equation."

So that's one usage you can find for It

• 3

##### Share on other sites
9 hours ago, ciliath said:

It is usually used to help solve partial differential equations... But for houdini, well I'm not too sure. In image processing they use It for edge detection, maybe It could find some same usage on fluids? Else, I quote from Wikipedia "For instance, the net rate at which a chemical dissolved in a fluid moves toward or away from some point is proportional to the Laplacian of the chemical concentration at that point; expressed symbolically, the resulting equation is the diffusion equation."

So that's one usage you can find for It

I usually use laplacian as a factor of perturbation in a smoke or FLIP sim, so you compute the laplacian (curvature has also a very close effect as with laplacian) of your surface field + a gradient to displace your particles for example. In the case of a smoke sim, I drive the divergence with the laplacian, so you can get nice bulbs without the use of vorticles or custom particles solutions to perturb the vel field.

Hope that helps!

Alejandro

Edited by Pazuzu
• 7

##### Share on other sites

Thank you very much guys, great help!

Felix, when you say this: "So if you have a vector g(x,y,z) = (3x, y^2, 2z^2)"
...
You mean "the scalar value of the point in space is 3x + y^2 + 2z^2", right? Because I thought, that Houdini evaluates gradient as a direction (with magnitude) of scalar field.

Thinking about this helped me a lot, great, thank you, Felix: "Laplacian is the divergence of the gradient. So you would get the magnitude of acceleration of flow in a point."

If I am wrong, you don't have to waste your time with me I really appreciate how you have helped me now, thank you! I have to study more on my own.

##### Share on other sites
5 hours ago, Pazuzu said:

I usually use laplacian as a factor of perturbation in a smoke or FLIP sim, so you compute the laplacian (curvature has also a very close effect as with laplacian) of your surface field + a gradient to displace your particles for example. In the case of a smoke sim, I drive the divergence with the laplacian, so you can get nice bulbs without the use of vorticles or custom particles solutions to perturb the vel field.

Hope that helps!

Alejandro

Hey, that's really smart.

I knew of the method with curvature, but using the laplacian instead that's cool.

Thanks for the insight :>

##### Share on other sites

Hey @Pazuzu,

Could you post a simple hip file of this? Thanks

• 1

##### Share on other sites
19 hours ago, Diego A Grimaldi said:

Hey @Pazuzu,

Could you post a simple hip file of this? Thanks

Hey Diego!

Sure! Here is a very basic FLIP surface tension implementation using laplacian as a factor; You can change from Laplacian to Curvature to see some little differences, But for most cases Laplacian works better for my tests, and even better yet for smoke, as you can see in the example file, the FLIP sim behaves almost like a pyroclastic cloud at the begining, so imagine this in a gas sim.

Hope That Helps!

Alejandro

Edited by Pazuzu
• 9

##### Share on other sites

This is sooo aawesome thanks guys