Jump to content
ikoon

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

 

Share this post


Link to post
Share on other sites

this should help
later in the thread they also talk about laplacian
 

 

Edited by 3dome
  • Like 1

Share this post


Link to post
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 this post


Link to post
Share on other sites

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

  • Like 1

Share this post


Link to post
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 :)

 

 

  • Like 3
  • Thanks 1

Share this post


Link to post
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
  • Like 8

Share this post


Link to post
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 this post


Link to post
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 this post


Link to post
Share on other sites
Quote

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. :)

I have a question for you @Pazuzu. I think I understand your use of laplacian or curvature (of density field I guess ?) as scalar masks but I wonder what kind of vector field you use to inject or modulate velocity field into smoke simulation. Did you use the gradient of density field as in your flip ST examples ? 

Best regards.

Share this post


Link to post
Share on other sites
On 4/18/2020 at 11:33 AM, mathieu said:

I have a question for you @Pazuzu. I think I understand your use of laplacian or curvature (of density field I guess ?) as scalar masks but I wonder what kind of vector field you use to inject or modulate velocity field into smoke simulation. Did you use the gradient of density field as in your flip ST examples ? 

Best regards.

Hi Mathieu! 

Yes exactly, I used the gradient of the density field modulated by the laplacian  to then modified the velocity of the system. One thing that I did, and I think is very important to have more precise results, is to compute both the laplacian and the gradient using a SDF version of the density field. This will give way more power to sculpt your sim as well, for example you can even displace that SDF before the laplacian and gradient computation to inject details to your sim without using noises that can mess you vel field or introduce overshooting. Also this is way more lightweight than to compute 1000's of masks to drive your sim and to end up with a very nice looking sim but so bad simulation times.

I hope this is clear!

Thanks,

Alejandro

  • Like 1

Share this post


Link to post
Share on other sites

Thanks a lot for your answer and tips, very clear to me. Now i have to put your advices in practice :)

Thanks again.

  • Like 1

Share this post


Link to post
Share on other sites
On 19.04.2020 at 11:23 PM, Pazuzu said:

Hi Mathieu! 

Yes exactly, I used the gradient of the density field modulated by the laplacian  to then modified the velocity of the system. One thing that I did, and I think is very important to have more precise results, is to compute both the laplacian and the gradient using a SDF version of the density field. This will give way more power to sculpt your sim as well, for example you can even displace that SDF before the laplacian and gradient computation to inject details to your sim without using noises that can mess you vel field or introduce overshooting. Also this is way more lightweight than to compute 1000's of masks to drive your sim and to end up with a very nice looking sim but so bad simulation times.

I hope this is clear!

Thanks,

Alejandro

Can you please tell us how you turn the density field into sdf, the nodes that do this are not in dop

Share this post


Link to post
Share on other sites
1 hour ago, kuvaka said:

Can you please tell us how you turn the density field into sdf, the nodes that do this are not in dop

You can do it with some microsolvers, but is a bit of a pain and the resulting sdf will lack of detail. The best way is to use a vdb pipeline inside a sop solver, you will have all the vdb arsenal at your disposal. 

Share this post


Link to post
Share on other sites
7 minutes ago, Pazuzu said:

You can do it with some microsolvers, but is a bit of a pain and the resulting sdf will lack of detail. The best way is to use a vdb pipeline inside a sop solver, you will have all the vdb arsenal at your disposal. 

Thank! It turns out that I do so, but it was curious how this can be done inside the dop

thank

Share this post


Link to post
Share on other sites
21 minutes ago, Pazuzu said:

You can do it with some microsolvers, but is a bit of a pain and the resulting sdf will lack of detail. The best way is to use a vdb pipeline inside a sop solver, you will have all the vdb arsenal at your disposal. 

And here is another question, do you use any masks or restrictions for your pyroclastic?

Share this post


Link to post
Share on other sites
Posted (edited)
16 minutes ago, kuvaka said:

And here is another question, do you use any masks or restrictions for your pyroclastic?

When I worked on that solver (from the vimeo video) I used the standard pyroclastic noise displacement, but I used also the curvature (or you can use laplacian as well) as the main factor for the pyroclastic displacement and decimation. So yes that was my restriction/mask, mainly to have a more nicer evolving material, and I think it works, of course, the video just shows the backbone of the system, but you can have way better details developing it a bit more.

Edited by Pazuzu

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×