Jump to content

VDB Analysis (Laplacian, Divergence)


ikoon

Recommended Posts

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

Link to comment
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
Link to comment
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
Link to comment
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.

Link to comment
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 :>

Link to comment
Share on other sites

  • 2 months later...
  • 3 weeks later...
  • 3 years later...
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.

Link to comment
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
Link to comment
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

Link to comment
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. 

Link to comment
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

Link to comment
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?

Link to comment
Share on other sites

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
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...