Jump to content

Flip in container - meshing for correct refractions


Skybar

Recommended Posts

I was scratching my head all day yesterday, I'm trying to mesh a flipsim in a container so that the refractions is correct. Like this picture: 

post-9276-0-24323800-1409212206_thumb.jp

I was mainly fiddling around trying to solve it with VDBs. The red/green part is easy enough, but cutting the glass/blue part seems like a whole other case. I'm trying to avoid using the Cookie SOP since that 9 out of 10 times breaks and creates holes. My flipsim or container isn't as simple as in the picture, just to mention that.

 

I'm sure there is a way good way to do this, I just can't figure it out. Does anyone have any insight on this?

Link to comment
Share on other sites

Does that give clean edges that actually align to each-other?  I recall trying it, and finding it was a bit messy... and then going to the OpenVDB site, and reading in the latest patch-notes that a far better method had been implemented.

 

I was under the impression that version of OpenVDB hadn't been implemented into official Houdini builds yet.

Link to comment
Share on other sites

you could probably get there with some reflection/refraction mask stuff.

 

objects: A = containter, B = sim mesh

At = copy of A

 

At is phantom

A's reflection mask excludes At

A's refracton excludes A and B

 

At's reflection mask excludes A and B

At's refraction mask excludes At

 

if you make B overly large, it will push into the container, but won't be hit by refraction rays since no traced ray inside of the container would include B in its mask.

 

you could do some kind of attribute manipulation on your surface to change the ior where the mesh surface meets the container surface.  you might also be able to pass messages on rays or do some kind of shader coding to figure out where you are.  also might be able to do it all with a more complex masking scenario (including a Bt with custom masks)...

Link to comment
Share on other sites

Hi,

 

What you think about this, i just tried with simple glass example, to mesh side to be same as glass object and not overlap,

 

image01 show glass and fluid how they intersect.

image02 i tried to subd glass few times to get smooth object and use same workflow look clean and smooth, but not sure if this will work with your object.

 

i meen this is not what you asked, to cut edges but this clean sides can help if you have some milk, juice stuff where you need entire mesh for better refraction.

 

Igor

post-2996-0-13327600-1409243907_thumb.jp

post-2996-0-82682000-1409243921_thumb.jp

fluidGlass.hip

Edited by CeeGee
  • Like 1
Link to comment
Share on other sites

I've tried time and again to try and get a robust solution to this using ray masking and such.  The problem is, you're trying to define three different interfaces, between two surfaces and each surface and the air, each with different refractive densities, and without a clear way to define where on the glass one interface ends and the other begins.

I've even tried by masking objects according to ray-bounce-level, but that screws up the moment you need to take total-internal-reflection into account.

 

VDB should be the definitive way to do it (especially when you can just reuse the same VDB you use to mesh the fluid), but not with the currently implemented build unfortunately.

 

I haven't tried it, but in the OpenVDB 2.3.0 notes, there's the line:

Houdini: Added a Clip SOP, which does volumetric clipping

 

 - which sounds like exactly what is required.  A precise geometry clipping algorithm that cuts along an isosurface boundary.

 

 

I presume OpenVDB can be manually compiled to include into current Houdini builds... has anyone tried it?

Link to comment
Share on other sites

thats my take on this problem. its a pretty involved setup tough... you need to write out a very dense point cloud of the glass object, feed that into the shader and write out a point cloud for the contact points. there is a help card in the otl with the exact steps. i am by far no houdini expert and im sure someone more experienced could fines this...

PC_Glass000.otl

Link to comment
Share on other sites

Cheers for the replies! A combination of Igors and Miles tips seems to work okay. 

 

OpenVDB 2.3.0 seems interesting as well, with the new VDB Clip SOP. It looks like you can download it and compile it yourself, however I have no idea how to do that. Is there any resources somewhere on how to compile stuff for Houdini? I've never done it but I'd like to get into it.

Link to comment
Share on other sites

Yeah, I'd really like to know if there are any useful resources for this too.  I mean to properly look into it eventually, but I'm no programmer, so a "compiling stuff for Houdini for dummies" guide would be a great thing to find :-)

Link to comment
Share on other sites

...

I haven't tried it, but in the OpenVDB 2.3.0 notes, there's the line:

Houdini: Added a Clip SOP, which does volumetric clipping

 

 - which sounds like exactly what is required.  A precise geometry clipping algorithm that cuts along an isosurface boundary.

...

Volume Break SOP does this with houdini SDF volumes

it's fast, precise and stable, It doesn't resample the cut boundary edge though, which I'm not sure if volumetric Clip SOP does or not, but it's kind of necessary when cutting low res geo

Link to comment
Share on other sites

Interesting, I didn't realise that existed.

But yeah, the fact that it only intersects the isosurface at edges, rather than across the whole polygon face, I think would limit its use in this case.

I'm hoping the VDB Clip SOP does this :-)

Link to comment
Share on other sites

  • 2 months later...

Igor's method works really well in my situation. I just added a VDB reshape SDF set to dilate on the B side of the combine VDB sop. And slowly increase the dilate value by small increments until all the gaps in the fluid are completely gone and it sits perfectly flat on the container. The reasons there is such a large gap between my fluid sim and the container is because I had to use a little but of offset on the collision geo in DOPS. Not sure how to get around that issue post sim.

Link to comment
Share on other sites

  • 3 months later...

Hi 

I have altered the HIP file this thread provided to move the collision glass around.

My question is: Can I avoid rebuilding the VDB of the glass in each frame ?

Can I just transform the VDB from frame 1 to match the movement ?

The shape of the glass doesnt change so I would guess that it should be possible.

fluidGlass.hip

Edited by dulo
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...