Jump to content
magneto

How to create a VDB SDF volume?

Recommended Posts

Hi,

I wanted to check out the VDB volumes but anyone knows how to create a VDB SDF volume? I briefly looked at the SOPs under VDB but couldn't see anything that might do this.

Thanks :)

Share this post


Link to post
Share on other sites

'surface' and 'distance' volumes are the same thing as sdf. All of the vdb generating sops ie vdb from particles or vdb from polygons has it enabled to build an sdf by default

  • Like 1

Share this post


Link to post
Share on other sites

Thanks, that helped. Can I just drop in a VDB from Polygons instead of an old SDF volume? Because when I did that and saved the attribute values for each point of a geometry using this volume that represents another geometry, the attribute values are completely different. I am using Volume Sample in a VOPSOP and the old volumes give me the correct distance values from this volume to my geometry.

But the VDB SDF has different distance values. Is it a matter of playing with the VDB parameters?

Share this post


Link to post
Share on other sites

The VDB from Polygons is the right one to use to make an sdf. You should understand 2 things... 1 is that that vdb does not fill the volume the same way, since it uses sparse volumes you only get proper values within your set voxel bandwidth (increase bandwidths and/or fill interior depending on your needs). 2 is that the sdf values for vdb are flipped (negated).

  • Like 1

Share this post


Link to post
Share on other sites

Thanks alot. I didn't know they had Houdini samples there.

@Solitude, now it starts to become more clear when you explained it :) I just assumed it was a drop in place to get instant speed and memory savings :) I will experiment with this.

Share this post


Link to post
Share on other sites

Also guys I just tried the Fill Interior and it works great, and actually solves another problem for me :)

Because I don't know why this is happening. In both SDF volumes, I have a simple grid and a sphere and I am checking the value (Volume Sample) for the point at the exact center of the sphere volume and the IsoOffset's SDF gives me -0.86, while VDB gives me 0.99, which is close to what I expect.

I understand the sign difference but I mean the absolute value. Increasing the resolution of IsoOffset's SDF from 30 to 100 brings the value up to -0.95, which is not bad but I was hoping -1 or -0.99. VDB SDF only has 50K voxels, and yet gives more accurate values.

Does this have to do with volume resolution and VDB somehow interpolates the values better? Or are SDF volumes something VDBs are better at?

Thanks :)

Edited by magneto

Share this post


Link to post
Share on other sites

That might make sense if they are corner sampled and VDB's are center sampled. I don't know if that's the case or not. Could have to do with interpolating the values of surrounding voxels too.

  • Like 1

Share this post


Link to post
Share on other sites

is that the sdf values for vdb are flipped (negated).

That is false. The SDF values in a VDB follow the same convention as native Houdini volumes. Just append a Volume Slice and look at the values in the spreadsheet.

Share this post


Link to post
Share on other sites

Ah... k. I was actually basing that statement off of the Fluid Source sop. It outputs collision volumes negated.... and I was trying to get a vdb collision working, but had to set the source volume's multipler to -1 in dops. Figured it would best up to work with just a default signed sdf.

Share this post


Link to post
Share on other sites

Ah... k. I was actually basing that statement off of the Fluid Source sop. It outputs collision volumes negated.... and I was trying to get a vdb collision working, but had to set the source volume's multipler to -1 in dops. Figured it would best up to work with just a default signed sdf.

This is because for obscure historical reasons, the collision field in Houdini fluids is indeed inverted from what you might normally think. Since FluidSource is directly manipulating the collision field, you have to invert the source volume before merging it into the collision field. But you have to do the same thing if the source volume is a regular, non-VDB SDF from the IsoOffset SOP, for example.

Edited by johner

Share this post


Link to post
Share on other sites

^Indeed, I was even testing on an isooffset before I posted that to double check. Thanks for clarifying. I do vaguely remember this, but after using the fluid source for so long, I must have forgotten. :)

Share this post


Link to post
Share on other sites

Do you guys know the best way to represent a sphere as an SDF volume? When I convert a primitive or polygonal sphere, it's not as smooth because of resolution. NURBS seem to give better result at low resolution but seems slower to convert to a volume.

Can I just populate some points as spherical SDF volumes? Using a spherical SDF VDB and then copying it onto points take 30 seconds and 5GB of memory. I was thinking of combining it as a single volume afterwards, but this is not effective anyway.

Instead of converting an actual geometry, is there a procedural way to create these shapes mathematically as volumes, SDF in my case?

Thanks :)

Share this post


Link to post
Share on other sites

Do you guys know the best way to represent a sphere as an SDF volume? When I convert a primitive or polygonal sphere, it's not as smooth because of resolution. NURBS seem to give better result at low resolution but seems slower to convert to a volume.

vdbfromparticles seems to be by far the most efficient to do this from my tests. just create a point in the centroid of your sphere, give it pscale to match the sphere's size and feed it into vdbfromparticles. It's very precise and fast as far as I can tell.

  • Like 1

Share this post


Link to post
Share on other sites

Thanks that looks like a good idea. I just tried it but VDB from particles do not have a Fill Interior feature, which changes the result. Is there a way to set this for a volume? VDB from polygons have this feature.

Share this post


Link to post
Share on other sites

Do you need the Fill Interior feature if you're doing an SDF? The point of an VDB SDF is so that you maintain the narrow band only.

  • Like 1

Share this post


Link to post
Share on other sites

Thanks Edward, I think I do :) Because I am doing checks to see if points are inside the SDF volume. If the inside is not filled, then I am getting very faint colors that are normally supposed to be full values. So basically my assumption was that if the inside is not filled, then SDF values are not as accurate. But the difference is huge.

Though if the point of VBD SDF is to maintain a narrow band, why does VDB from Polygons have a feature called "Fill Interior"? :) Outside is another deal though. I only need to know if my points are inside.

Share this post


Link to post
Share on other sites

But the inside of VDB SDFs will still have a negative value. If you just need an "is inside" test, then that should work with narrow band SDFs. What you will not get is accurate distance values outside of the narrow band.

  • Like 1

Share this post


Link to post
Share on other sites

Thanks Edward, you explained it perfectly. Sorry I didn't say it but the colors I used were scaled based on distance, so I actually need the distance :)

Do you think in this case standard Houdini SDF is better?

Edited by magneto

Share this post


Link to post
Share on other sites

If what you want is "dense" data after all, then I'm not sure if VDBs will buy much. I suggest you test the differences for a single sphere with a tight volume bbox.

  • Like 1

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

×