Jump to content

multiply collision with density


mrWolf

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

collisioncopy=collisioncopy*density

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.

Link to comment
Share on other sites

@bloomendale

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

@ikarus

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.

IMPORTANT:

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