Jump to content

Getting a gradient and occlusion field for a pyro sim


anderslanglands

Recommended Posts

I'm pretty new to Houdini so please forgive me if there's an obvious solution here. I have a pyro sim (basically just the fireball preset) which I've converted to VDB for rendering. I want to do displacement at render time based on the gradient of the density field to get a sort of normal. To do this I'll need the gradient, then I'll need to expand it into a "shell" around the densities in order that empty voxels can find their way down to density values. How would I go about setting this up (in simple terms please!)?

 

Also it would be nice to be able to find the "valleys" in the sim so I don't displace as much in those areas. Intuitively, I want an "ambient occlusion" value in the cache in order to be able to mask those areas from displacement at render time. Any idea how I'd go about that?

 

Thanks for any pointers!

Link to comment
Share on other sites

OK so I've figured out I can use the VDB Analysis node to generate the gradient from the density primitive, but this replaces my existing density primitive. I want to keep the original density field and add a new primitive called density_gradient. How can I achieve that? I've tried the Volume Merge node but that doesn't seem to do anything

Link to comment
Share on other sites

you can compute your volume gradient at render time.  use an inline vex function and do:

 

$vec = gradient($density);

 

($vec is your output vector in your inline function, and plug your density into the input)

 

in terms of limiting the scope of your displacement, you can generate a volume in sops to handle that as a multiplier.

 

to get additional fields to mantra, you just merge them in as additional primitives.  mantra uses the field names (when they exist) to help it bind to shader parms.

 

so your field called "density" is the thing that feeds the "density" parm in your shader.  if you create a new field called "dispMag" (as a float field) you could create a shader parameter called "dispMag" and it'd pick up that field from mantra at render time.

Link to comment
Share on other sites

Hey Anders,

 

I forgot to mention, for the other thing you want, to measure the valleys and peaks, I think you want to use a vdb analysis node to measure the curvature of your density field. Not sure if it is exactly what you are looking for, but should be close.

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...