Extracting outer 'surface' resulting from VDB subtraction?

   1694   4   0
User Avatar
Member
203 posts
Joined: May 2021
Offline
The outer surface resulting due to subtraction of geometry can be extracted using boolean SOP very efficiently and easily. Is there a way to extract it when doing VDB operations? The yellow colour was done in snipping tool.




Doing a boolean subtraction with polygons, extracting surfaces separately, then converting it to vdb will be computationally expensive.

I am trying to learn to develop animations like these.
https://www.instagram.com/p/CdOQmk1Kher/ [www.instagram.com]
https://www.instagram.com/p/CYg_igzvnct/ [www.instagram.com]
Edited by proceduralist - April 13, 2023 11:22:02

Attachments:
VDB SUBTRACTION QUESTION.hip (493.6 KB)

User Avatar
Member
4723 posts
Joined: Feb. 2012
Offline
Hi,

You can volume sample the sphere SDF to color the inner points:



float tol = ch("tolerance");

float s = volumesample ( 1, 0, @P );
if ( s <= tol )
    @Cd = { 1, 1, 0 };
Senior FX TD @ Industrial Light & Magic
Get to the NEXT level in Houdini & VEX with Pragmatic VEX! [www.pragmatic-vfx.com]

youtube.com/@pragmaticvfx | patreon.com/animatrix | pragmaticvfx.gumroad.com
User Avatar
Member
203 posts
Joined: May 2021
Offline
Thanks for the quick reply! I am not getting 'attribute to match' option.


Sorry. My bad. It's working now. I made a mistake earlier by connecting wrong nodes.


I don't understand fully what exactly is happening in the VEX code. Can you please explain or provide a method using Point VOP?

What I can figure out so far.

float tol = ch("tolerance"); Here we defined a float called tolerance with channel slider.

float s = volumesample ( 1, 0, @P ); No idea what is happening here.
if ( s <= tol )
@Cd = { 1, 1, 0 }; If 's' is less than or equal to tolerance, then apply a yellow colour.
Edited by proceduralist - April 13, 2023 13:19:02
User Avatar
Member
4723 posts
Joined: Feb. 2012
Offline
With volumesample we sample the SDF volume for signed distances so inside will be negative, outside positive and SDF boundary will have 0. That's why we are using some tolerance to "inflate" the SDF boundary for coloring.
Senior FX TD @ Industrial Light & Magic
Get to the NEXT level in Houdini & VEX with Pragmatic VEX! [www.pragmatic-vfx.com]

youtube.com/@pragmaticvfx | patreon.com/animatrix | pragmaticvfx.gumroad.com
User Avatar
Member
203 posts
Joined: May 2021
Offline
Alright. Thanks!
  • Quick Links