# VDB Curvature Flow

## Recommended Posts

Hi everybody, I´m Igor a long time lurker but first time poster here on OdForce

I´d like to ask what is best way to calculate curvature flow in volume. I searched the docs and found VDBAnalysis with curvature option but how can I calculate other curvature type like Vectorfield follows curvature?

Thanks for any idea!

##### Share on other sites

No one has any idea how it can work?

Maybe I did explain it badly (sorry for my English btw.) but pictures show best what I mean. It is Vectorfield that follows the curvature of Levelset. Is there any way to do it with VDB in Houdini?

Thanks!

##### Share on other sites

Not quite sure what you want to do, but if you want to create a flow field around an object then you could use info from this post ...

##### Share on other sites

Thanks Dan!

I had look at the post but this is not what I mean. What I mean is Vectorfield that describes the surface in regards to curvature. If you look at pictures you can see how vector does follow surface with strong curvature and I want advect particles along this Vectorfield. Hope it is clear what I mean.

Thanks!

##### Share on other sites

not sure if this is what you meant, but looking at the images in your second post i would say you are talking about principal curvature directions. if so, i don´t think there is any direct method in houdini but it shouldn´t be too hard to implement with a volumewrangle ...

hth.

petz

• 1

##### Share on other sites

Thanks petz! You are right, Pricipal Curvature Direction is what I mean. I found formula on Website of MIT but do not know how to tranlate into VEX. Formula

Can somebody give me hint how to do it please?

Thanks!

Edited by Igor

##### Share on other sites

Fantastic file! Thanks Petz.

##### Share on other sites

Thank you so much petz! This is wunderful and is exact what I wanted to do.

##### Share on other sites

Will look at this hip file soon, but I think what you are wanting is to get the vector direction of the sdf surface, then get the average sdf of surface in the area (could use projected point cloud in this) and then using a cross product between the original surface direction vector, and the local average's, you will get a new vector field that flows along the surface that appears like the image you posted, it kind of resembles topology of a map.

• 1

##### Share on other sites

Thanks Jamie!

I did try your idea and also got Vectorfield but it is different as in example from petz. It is not pointing in direction of curvature. Can you explain the difference? Perhaps Problem is that I did it on polygon-surface because I do not know how to get pointcloud around sampling Point in VDB.

##### Share on other sites

Petz, your knowledge is amazing. Thank you for your source file, I am trying to understand the math behind it, you helped me a lot. But it is quite a long run I forgot lots of things from the university.

Please, why are there those interesting "zigzags" in the attachement? The gradient of curvature should be theoretically smooth, no voxels are missing and increasing the iteration accuracy doesn't help.

Hessian matrix, mean curvature value (from its diagonal), gradients, cross and dot products

I would like to achieve these kind of effects:
http://forums.odforce.net/topic/28239-gabor-kernels-oil-painted-cop-convolution-filter

What do you think is crucial to learn next? I will study these:
eigenvectors, trace of matrix

Do these lead me to some creative effects? Do I have to understand them really well?
frobenius norm of matrix, outer product(shape operator), inverse power iteration

If anybody could direct me, I will really appreciate.

vdb_curvature - zigzags - v0.hipnc

• 1

##### Share on other sites

the "zigzags" in the trails are the result of vectors pointing into opposite directions and this is due the way how they are calculated. when you calculate the eigenvectors of the matrix there is no easy way to determine in which direction (+ or -) the vector is pointing because both directions are true. an easy way to handle this problem is to check and reverse neighbouring vectors recursively, starting from one point, or write your own streamline algorithm in vex which ignores opposite vectors based on a given threshold. either way, this is not be a perfect solution but depending on your needs it might be enough. if you want a vectorfield on the mesh which is as smooth as possible, then that´s a completely different story and it becomes much more complicated...
in regards to your other question, if you need to fully understand all the things in the file, i would say no. it´s nice and sometimes helpful if you do but this is something you´ll barely need for day to day work. but that is just a personal opinion based on personal experience and not an advice by any means.

hth.
petz

• 1

##### Share on other sites

VDBAnalysis SOP.
outputs whatever field you want

Edited by fuat

##### Share on other sites
3 minutes ago, fuat said:

VDBAnalysis SOP.
outputs whatever field you want

no, it doesn`t ...

• 2

##### Share on other sites
On 6/22/2016 at 10:34 AM, Igor said:

It is Vectorfield that follows the curvature of Levelset

that was what he asked for? doesnt the vdbanalysis exactly output that? or am i missing something? correct me if i  am wrong

##### Share on other sites

well, it is possible to get the curvature, or more precisely the mean curvature with vdbAnalysis but not the curvature-direction. even though you could get a somewhat curvature-related vectorfield, if you calculate the curvature first and then the gradient of it (which is possible with vdbAnalysis) it wouldn´t be the same. principal curvature directions are quite different and sometimes they are useful since they have a few special properties.

##### Share on other sites
On 6/22/2016 at 10:00 AM, Igor said:

Thanks Dan!

I had look at the post but this is not what I mean. What I mean is Vectorfield that describes the surface in regards to curvature. If you look at pictures you can see how vector does follow surface with strong curvature and I want advect particles along this Vectorfield. Hope it is clear what I mean.

Thanks!

Created a tool to calculate the gradient and curl along the curvature of a given geometry.

If I'm understanding what you're looking for correctly I think this might help: (link to the file is in the vimeo description)

It runs on geometry but there's no reason you can't go to and from volumes.

Hope this helps,

-Tighe

Edited by trzanko
• 2

##### Share on other sites
On 24.6.2016 at 8:03 PM, petz said:

attached is a file with all sorts of curvature computation for vdbs

Thank you for sharing this! Is there any way on a volume to

• normalize and regularize curvature values between -1 and +1 ?
• place unique points on local minima and/or maxima?

##### Share on other sites
On 6/24/2016 at 9:03 PM, petz said:

attached is a file with all sorts of curvature computation for vdbs ...

hth.

petz

This is so helpful! thank you for sharing! Is it aslo possible to get the gradient y component of a volume like you do with a measure sop on meshes?

Edited by papsphilip

## Create an account

Register a new account