Jump to content

Masking VDB solver growth by Cd


stas3dart

Recommended Posts

Hello friends. Perpetual Houdini n00b here. Have a question that I hope experienced users could help me with.
 
In essenece - I'm trying to mask my solver growth areas by painting b/w mask on my geo.
 
I am creating a solver growth for my geo. Converting a mesh into a VDB, sticking it into a Solver. Inside solver I calculate the gradient and curvature of the VDB, plug them into VolumeVOP, where I multiply them together and bind the output to gradient and pipe out to VDBAdvect.
So all great, simple growth happening all over my mesh. I can mask it by plugging an extra noise into my multiply node.
 
What I'd like to do though is to be able to mask it by painting custom b/w maps onto my geo prior to it going into solver. I can use attributePaint to the mask with on my Cd. But I have no idea how to access this Cd info inside my solver. I can add it as Surface Attribute to my VDB, but that messes everything up for some reason.
 
I've attached the file, might be easiest to just see it in there instead of reading my explanation:
 
Thanks for any suggestions the mighty ones!

maskGrowth_v01.hiplc

Link to comment
Share on other sites

Heyo!
The reason why it was messing up was two-fold, number 1 is that when you use "vdbfrompolygons" and select the "surface" volume, it creates something called an SDF (signed distance field) volume, whilst when you convert your Cd attribute to a volume it creates another volume type called a fog volume. SDF's are very nice for doing the types of deformations you are doing-especially when the plan is to eventually convert the volume back to a mesh, the fog volume is more for traditional volume stuff like simulating and rendering pyro. These two types don't mix so you'll have to convert the fog volume you get from your Cd volume into an SDF volume, which brings us to issue number 2. Cd is a vector attribute, basically meaning it consists of three values, in this case, r, g, and b color values for each point. When working with an SDF volume it only really wants one single value in your volume which is the distance to the "surface" of the volume so to be able to convert from a fog volume to an SDF volume your fog volume needs to only be made up of a single float value (float value is a fancy way of saying numbers with decimal values). The quickest and dirtiest way of doing this is to simply take one of your color channels and put it in a new attribute, like: f@mask = v@Cd.r; (This mostly only works if you are making a black and white mask since when stuff is black and white all the r, g and b values are the same).

I've attached a quick hipfile below and marked the two nodes I added to your setup. Hope this can help!

maskGrowth_v01_mnb.hiplc

  • Like 1
Link to comment
Share on other sites

Hi Martin,

Thank you for such a detailed breakdown and the scene file. That's super helpful! I will have another read in the morning to make sure I understand it all properly.

So I basically need to break it into two vdbs and have growth happening on the masked part and then merge it with VDB of the unmasked part? I think that would work, thank you :) Was just wondering if there would be a simpler way of keeping it all in one VDB, and somehow bringing in the Cd info or a texture map info into the VolumeVOP inside solver, but if that's not doable, I think this method would work great too. Thanks again!

Link to comment
Share on other sites

9 hours ago, stas3dart said:

Hi Martin,

Thank you for such a detailed breakdown and the scene file. That's super helpful! I will have another read in the morning to make sure I understand it all properly.

So I basically need to break it into two vdbs and have growth happening on the masked part and then merge it with VDB of the unmasked part? I think that would work, thank you :) Was just wondering if there would be a simpler way of keeping it all in one VDB, and somehow bringing in the Cd info or a texture map info into the VolumeVOP inside solver, but if that's not doable, I think this method would work great too. Thanks again!

Both yes and no(not really, you can totally do it but I'd recommend against it) :D
Yes, you can totally merge it all into one stream and just work on the masked volume, however, I'd recommend not. If you can limit the amount of data passing through your solver sop and all the VDB nodes in there then you can keep your setup as snappy and quick as possible. In your case, I don't think it'd be a problem either way since your VDB's aren't very high res and should process fairly quickly no matter what but as a matter of principle I'd recommend you merge in whatever you don't want/need to deform after the solver sop.

Added a new file below, hope I did not misunderstand again.

maskGrowth_v02_mnb.hipnc

  • Like 1
Link to comment
Share on other sites

Martin, you are a legend. Thank you for your time and the super detailed explanations. This was incredibly helpful and very interesting to learn about good practices. If you're ever in London or if I'm ever in Oslo once the world is back to normal - I definitely owe you some beverages :)

  • Like 1
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...