Jump to content
Juraj

VDB SDF interior lost after volume dilation

Recommended Posts

Hello,
I am creating sdf vdb volume from polygons. I need filled interior, because later on I will sample those values. However I would like to process my volume a bit, for example smooth, dilate etc. After those operations interior voxels are lost, only area close to the surface contains voxels.

Is there a way to get those values back?

Thanks,
Juraj

Share this post


Link to post
Share on other sites

I haven't tried this but perhaps something like: Use Convert VDB to convert it to a fog volume, do your operations as a fog volume, use Convert VDB to convert to polygons, use VDB From Polygons to convert back to an SDF with fill interior.

Share this post


Link to post
Share on other sites

Don't know why it behaves like it does, but if you increase the exterior band it seems to work. You get more voxels but I couldn't figure out something else.

Share this post


Link to post
Share on other sites

If you are eroding a surface VDB, you can use the VDB Activate SDF to activate a wider band of voxels to do the erosion in to.

You can also use the more involved VDB Activate SOP with far more options to activate regions of the VDB grid to do your work including second input geometry to act as a mask for active regions.

VDB's are efficient due to the thin band of data that exists around the limit surface in SDFs and volumes around the data that is varying between constant values (density usually 0 to 1). Generally the thin band is defaulting to 3 voxels either way of the 0 value for SDF and around the 0-1 varying band in Density VDB volumes: Exterior Band voxels and Interior Band voxels. These two parameters are exposed on the VDB from Polygons SOP.

Please use the VDB Visualize SOP to see the active band. IMHO you simply can not sculpt VDB's without using this SOP somewhere in the chain to avoid this issue. Use the Active Voxels toggle parameter and set to points to see where the active voxels are. You can't push data in to a region of the VDB grid that has inactive voxels. You will get no result which is what you are experiencing.

Share this post


Link to post
Share on other sites
4 minutes ago, old school said:

If you are eroding a surface VDB, you can use the VDB Activate SDF to activate a wider band of voxels to do the erosion in to.

You can also use the more involved VDB Activate SOP with far more options to activate regions of the VDB grid to do your work including second input geometry to act as a mask for active regions.

VDB's are efficient due to the thin band of data that exists around the limit surface in SDFs and volumes around the data that is varying between constant values (density usually 0 to 1). Generally the thin band is defaulting to 3 voxels either way of the 0 value for SDF and around the 0-1 varying band in Density VDB volumes: Exterior Band voxels and Interior Band voxels. These two parameters are exposed on the VDB from Polygons SOP.

Please use the VDB Visualize SOP to see the active band. IMHO you simply can not sculpt VDB's without using this SOP somewhere in the chain to avoid this issue. Use the Active Voxels toggle parameter and set to points to see where the active voxels are. You can't push data in to a region of the VDB grid that has inactive voxels. You will get no result which is what you are experiencing.

But isn't it a little bit strange though? Say I have a sphere, turn that into a VDB with 'Fill Interior' on. Now I have active voxels with values inside my sphere. If I then dilate this VDB, voxels on the inside will deactivate - and the values I had there before is gone. I get that the narrow band is expanding along with the SDF, but seems a bit odd when I explicitly told it to Fill Interior before. What I should have done instead then is to increase the narrow band straight from the start? Doesn't that, in some cases, make the Fill Interior option kinda redundant? 

  • Like 1

Share this post


Link to post
Share on other sites

Scratch everything I said before. Just make an HDA called "Fill Interior SDF" that converts to polygons and does VDB From Polygons with Fill Interior.

 

I doubt that increasing the exterior band will actually cause VDB Reshape SDF to fill the interior.

 

Note that there's some argument that maybe one should just use native Houdini Volumes if you actually want dense volumes since that's what Fill Interior kind of does.

Share this post


Link to post
Share on other sites
45 minutes ago, edward said:

 

I doubt that increasing the exterior band will actually cause VDB Reshape SDF to fill the interior.

I've never thought about before, or really had any issues. But looking closer, I have NO idea what Reshape SDF is doing. Check this hip, isn't this weird to you?

vdb_weird_interior_band.hip

Share this post


Link to post
Share on other sites

Sorry, no access to Houdini right now but I can tell you what Reshape SDF is doing. An SDF means "signed distance field", it's volume that represents a surface by having the voxel values say how they are to where the surface is. So this defines the surface as the 0 voxels (ie. 0 distance away from the surface), or wherever the voxel values cross from negative values to positive values. When you dilate/erode, it just adds the offset value to all the voxels. This results in a shift at where the voxels cross the 0 value, and thus where the surface is represented. However, all the other shifted voxel values are no longer correct distances to where the surface is. So this now must be fixed. The approach that OpenVDB does is basically to convert to polygons (in a lightweight fashion I think>) at where the new surface voxels are, and then reconstruct the volume all over again with the correct voxel distances. With narrow band SDFs (ie. what VDB's are made for), you get the best properties if you just have a 3 voxel radius around your surface voxels so that's what it does. Since the Reshape SDF doesn't expose how it converts back from polygons, the interior is lost (and I would expect the exterior beyond 3 voxels as well).

Share this post


Link to post
Share on other sites

@edward Yeah that's what I would expect now. Before I thought 'Fill Interior' would always keep it filled, but I guess that doesn't really make sense after all. However, when/if you can check the hipfile - increasing the exterior band also increases the interior. If you are increasing it on the VDB From Polys and then Reshape SDF. 

Share this post


Link to post
Share on other sites

You're right, the SDF rebuilding is a bit smarter than just using a bandwidth of 3. It tries to maintain the size of the narrow band by looking at the background value (ie. the value used when you're outside of all active voxels). So when you have a larger exterior bandwidth, the background value becomes larger and you end up with a symmetric bandwidth equal to your exterior one. So I think what's happening is that the interior bandwidth after rebuilding is now the same as the exterior. So if you have a smaller voxel size after expanding your exterior, you'll probably get holes inside again.

Share this post


Link to post
Share on other sites
58 minutes ago, edward said:

You're right, the SDF rebuilding is a bit smarter than just using a bandwidth of 3. It tries to maintain the size of the narrow band by looking at the background value (ie. the value used when you're outside of all active voxels). So when you have a larger exterior bandwidth, the background value becomes larger and you end up with a symmetric bandwidth equal to your exterior one. So I think what's happening is that the interior bandwidth after rebuilding is now the same as the exterior. So if you have a smaller voxel size after expanding your exterior, you'll probably get holes inside again.

Sounds like a good explanation, so I'm not going crazy then. Thanks Edward!

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

×