Jump to content

multiply collision with density

Recommended Posts

Hi everyone :)

I'm using a smoke simulation where a simple source is dripping smoke on a collision box.

The collision uses the sourcevolume method, so I have the SDF collision available.

I'd like to create an additional field which is nothing else than the result between the multiplication (intersection) between the collision field (after gassdftofog) and the density field.

Basically I'd like to use this resulting field into a pyro symulation (a separated sim) as fuel to emit fire.

The result would be that some fire emits from the locations of the cube where the smoke is dripping.

I used a match field to fill a field "collisioncopy" scalar field, and filling it with the content of the collision sdf after converting it to fog.

Then I used a gaslinearcombination with the folliwing calculation


The problem i have is that obviously the collision field and the density field are mutually excusive so the result is an empty field.

My question is:

is there some quick and dirty way to "expand" a certain field by a certain amount of voxels (in the direction of the gradient of its density for instance).

This way i would be able to have an overlapping area between my collision field and the density and I could calculate the intersection between them.

Share this post

Link to post
Share on other sites

it would be easier to just sample your collision field at a different value other than zero. something like fit ( abs(@sdf - <iso level>),0,1,1,0) * @density

Share this post

Link to post
Share on other sites


that's exactly what i was looking for, thank you man


actually I thought about this solution 36 seconds after posting the question and I ended up adopting a very similar solution.

In SOP I converted my geo in VDB SDF then used a VDB RESHAPE SDF sop node in "dilate" mode, then converted it to houdini SDF, matched the dimensions of my sim fields with a volume mix and imported finally imported it in my dops network as a new field.

But your solution in VEX is way more elegant than mine.


The reason cause was trying to expand one of the fields was because I was using a gas linear combination to multiply density and collision fields but the result was always an empty field. So I thought it might have been cause the two fields are mutually exclusive (it makes sense since one is the collision) and adopted the solution above, but the result was always an empty field, which didn't make any sense, cause i could see visually that they were largely overlapping now.

I tried even changing the gas linear combination mode to "ADD" and I could see that both fields were added correctly.

Only the multiplication was giving this odd result.

After many tests, just for a chance, I disabled the option "additional constant" in the gas linear combination dop node and the result was finally correct.

The help on this option says "If set, an additional constant term is added to the equation. This is useful for applying a fixed bias to the whole computation".

In my case it was not "adding" any fixed bias (which by the way was zero). It was zeroing out the whole field (only when in "multiplication" mode).

Edited by mrWolf

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