Thursday 20 October 2016

Checking if a point is inside a volume

This can be done with a point wrangle, but for those that prefer VOPs...

create a point VOP, connect the geometry you wish to test into the first input. connect the volume you want to test with into the second.

Enter the VOP, create a volumesample. Connect P and OpInput2 into this node.
The value it returns (bind export this to something) indicates how "deep" within the volume the point is. A negative value means the point is within the volume & a positive value means it is outside of the volume.

reliable(r) collision objects in FLIP

The deforming object shelf button serves most collision purposes, even for static objects (turn off use deforming objects) but sometimes it doesn't quite cut it.

Add a trail node, set to "calculate velocity" to your moving geometry.
Create a VDB from polygons node, setting the name of the volume to "collision" and add a point attribute at the bottom, choosing the "v" as the option. Name this "collisionvel". These names are defaults in Houdini.

In your FLIP sim dop-network, add a "volume source". Set the initialisation to "collision" and navigate the SOP path to the VDB you made earlier. Set the scale to -1, because that's how the maths work..and change the velocity to whatever you want..1 is probably sensible.
Finally plug the volume source into the "volume" connection tab of the Flip solver.

That should be it.

Friday 14 October 2016

Exporting simple multiple objects from Houdini to Maya

Assuming... you've duplicated objects around, animated them etc... AND the objects are single mesh things. Eg. a Sphere, a torus.... Not a multi-object thing.

Create a "connectivity" node and set the connectivity type to Primitive. This should be connected to the group of objects you're exporting.

This creates a Primitive attribute which assigns an integer value, based on the object's "shell".
eg. the primitives in Cube 1 might have a value of 0, Cube3 might have a value of 4 or whatever..

Connect a Primitive Wrangle and put in:

s@path = 'fish_GRP/fish_' + itoa(i@class) + '_GEO/fish_'+ itoa(i@class)+'_GEOShape';

where the path attribute created is making a group called "fish_GRP" and objects called "fish_1_GEO" and their respective Maya shape nodes called "fish_1_GEOShape".

It seems necessary to build the complete hierarchy for Maya, otherwise the individual shape nodes are not so easily accessible..

Finally, using a ROP_Alembic node, output your file, making sure that you have
"Build Hierarchy from Attribute" ticked ON, and set to "path".
The other bits are left as default...

Thursday 6 October 2016

Importing an Alembic Camera from Maya

Create an alembic archive and bring the .abc file in that way.
If you need to scale it to account for Maya's scene scale, make a Null node, scale it as you will & plug the Alembic Archive beneath it.
If you mess about with any frame-time-offsets, be sure to click the Push Parameters to Children button.

Wednesday 5 October 2016

using object's rotation as a vector value.

A simple method would be to set the world aligned object's vector value to pure X,Y or Z (eg <<1,0,0>> for all X)before it ever gets transformed. As long as inherit attributes is active, the vector will also be transformed/rotated etc)
Useful for setting vectors to point in the direction of the object.

Tuesday 4 October 2016

velocity volume fields like Maya

It's possible to make a piece of geometry, pump it through a PointVOP and give it some velocity, using constants, curl noise or whatever method you like.
Then convert the polygon to a VDB, using the V point attribute. Name the field "vel".

Within POPs/dynamic network use an advect with volume operator. The defaults should keep the velocity's affect within the volume created.

If this doesn't work as expected you might need to use a Geometry Wrangle (within the POP/Flip/dynamics)
Using the code below, you'll want to set the 2nd input (in the input tabs) to the velocity volume created earlier.

vector vel = volumesamplev(1,0,@P);

v@force += vel * ch("scale");

v@a = vel;

Basically we're affecting the velocity via a force, rather than adding directly to it - to avoid overly strong changes in velocity. We also have extra control with a scale slider & the "a" attribute is a little debug value to watch out for in the Geometry Spreadsheet.
Note - you might have to really crank up the velocity values, depending on the current velocity of the existing particles/fluid/whatever.

*NOTE* The Geometry Wrangle should be plugged into the particles tab of the solver! (2nd one)