Resize Fluid Container with an Object
Published: March 30, 2011

Video
[79 MB QT - Duration 00:15:50]


Many times I get asked how can you resize a fluid container? Every time I answer this question I invariably come up with yet a new method. Goes to show you how flexible this amazing piece of software is.

I wanted to come up with a solution that had no real performance penalty and also follows my desire to do as much as possible in SOPs around any DOP simulation. If it is from the shelf, even better. This is exactly what I did for an audience on a recent trip and as usual, it was live, and with luck and only one typo, got it to go first try.

The "Resize Fluid" shelf tool is the first step I take in resizing any fluid container and this example is no different. In this example, I create a simple object that is used to resize the fluid container and make sure it is created before I execute the shelf tool.

Once the Resize Fluid tool is done, you can now freely control the size of the fluid container by animating the object and the geometry contained inside that object. Fetch the density field, scatter points and put a Bounds SOP on that and you are done.

Well, almost. I also like to wrap in velocity and in this case it is trivial to do. I fetch the velocity fields from the sim and in a simple VOP SOP, I project the points by the velocity fields properly compensated for the frame rate of course as we are solving per frame and not per second. Velocity is in Houdini units per second so you need to always divide by the frame rate to get the proper velocity values. By taking velocity in to account, if there is an area of high velocity, I can make sure that the container will be able to capture this and size accordingly.

One final thing on resizing fluid containers. I am a big believer in having a rich velocity field enveloping my simulation. I am willing to give back a bit of performance and consume the memory to do so. I do believe that you need to have considerable velocity surrounding the fluid that you are advecting by the velocity. In fast evolving and noisy containers, by watching the velocity fields and the sim results, over time you can see what I mean.

Keep the pedal to the metal,





User Comments
by td3d 2011-03-30 17:26:59
really helpful tutorial...many thanks!
by dpz 2011-03-30 18:37:31
very very nice. =)
by tamte 2011-03-30 19:10:30
I have posted an asset which does this a while ago, it comes with help and example scene, maybe it can be helpful too for somebody: http://forums.odforce.net/index.php?/topic/12503-generalist-showreel-and-tools/page__view__findpost__p__79256
by lisux 2011-03-30 20:33:21
Good tip Jeff! 
Thanks for sharing
by Achayan 2011-03-31 03:29:23
hi Jeff 
 
I am trying to do the same thing but getting some error message .. 
 
Traceback (most recent call last): 
File "dynamics_smokebox", line 4, in  
File "/opt/hfs11.0.658/houdini/python2.6libs/dopsmoketoolutils.py", line 1033, in dopEmptyFluidBox 
(dopnode, fieldnode) = createEmptyFluidBox(sceneviewer, fluidtype, buildmat=buildmat) 
File "/opt/hfs11.0.658/houdini/python2.6libs/dopsmoketoolutils.py", line 990, in createEmptyFluidBox 
dopimportnode = createObjectImportingFromFluid(dopnode, fluidtype, buildmat=buildmat) 
File "/opt/hfs11.0.658/houdini/python2.6libs/dopsmoketoolutils.py", line 743, in createObjectImportingFromFluid 
mat = createMaterialFromFluidType(fluidtype) 
File "/opt/hfs11.0.658/houdini/python2.6libs/dopsmoketoolutils.py", line 648, in createMaterialFromFluidType 
mat = createSmokeMaterial() 
File "/opt/hfs11.0.658/houdini/python2.6libs/dopsmoketoolutils.py", line 212, in createSmokeMaterial 
(mat, built) = findOrCreateMaterial("billowysmoke", "billowysmoke") 
File "/opt/hfs11.0.658/houdini/python2.6libs/dopsmoketoolutils.py", line 193, in findOrCreateMaterial 
galleryname + ".") 
OperationFailed: The attempted operation failed. 
No valid gallery found matching billowysmoke. 
 
I am using non commercial version of houdini 11.0.658 
 
Platform: linux-x86_64-gcc4.4 
OpenGL Vendor: ATI Technologies Inc. 
OpenGL Renderer: ATI Mobility Radeon HD 4500 Series 
OpenGL Version: 3.3.10524 Compatibility Profile Context 
OpenGL Shading Language: 3.30 
 
something wrong with my installation ?
by francoisd 2011-03-31 14:08:31
Thanks Jeff! 
 
If one wants to create a digital asset out of it, he can use the Timeinc parameter inside the vopsop on the global parameter node and multiply it by the velocity instead of dividing by a constant of 24. This way it's gonna work with any fps.
by jeff 2011-04-01 09:52:52
Francois, yes that is important to do and I passed over this. Definitely change the Divide By Constant to a Divide VOP and promote the second parameter and at the top level, drive this with $FPS which is the global variable for the current frames per second.
by jeff 2011-04-01 09:55:56
Achayan, your problem is obviously caused by one of the Houdini tools that executes python. Is this caused when you are executing the Resize Fluid tool? 
Did you try to run that tool while in DOPs or the OBJ context?
by Achayan 2011-04-02 02:10:49
Hi Jeff, 
 
No I am unable to create any fluid container .. i am not sure whats happening with my houdini installation :(, I am trying with obj level not with dop . None of my fluid tools is not working like pyroEx also. 
 
Traceback (most recent call last): 
File "dynamics_smokebox", line 4, in  
File "/opt/hfs11.0.701/houdini/python2.6libs/dopsmoketoolutils.py", line 1033, in dopEmptyFluidBox 
(dopnode, fieldnode) = createEmptyFluidBox(sceneviewer, fluidtype, buildmat=buildmat) 
File "/opt/hfs11.0.701/houdini/python2.6libs/dopsmoketoolutils.py", line 990, in createEmptyFluidBox 
dopimportnode = createObjectImportingFromFluid(dopnode, fluidtype, buildmat=buildmat) 
File "/opt/hfs11.0.701/houdini/python2.6libs/dopsmoketoolutils.py", line 749, in createObjectImportingFromFluid 
objectnode.parm("geo_velocityblur").set(True) 
AttributeError: 'NoneType' object has no attribute 'set'
by oslo 2011-04-04 06:22:09
Hi Jeff. I have fast moving pyro source. On low resolution i have good result, but on high resolution bounds lost. 
 
I try increase substep its help, only with help me ? 
 
Sorry for my english.
by jeff 2011-04-04 10:27:53
Hi Oslo, 
I think the scatter points is failing for some reason. 
I would check to see exactly what the DOP Import SOP is bringing in. You should be able to see the density field in the viewport.  
Can you send me the hip file to have a look at if you can't figure it out. Just email me at jeff_at_sidefx.com
by jeff 2011-04-04 10:28:22
Achayan, 
I'll continue this on your SESI forum post.
by Achayan 2011-04-05 09:57:10
Thanks Jeff , I am really waiting for a fix :(
by Achayan 2011-04-10 03:04:23
Jeff can you please give help for my problem ?
by oslo 2011-04-16 04:14:00
Jeff can we realize any autoresize with distribute generation via hqueue ?