Saturday 3 December 2016

Attribute Reorient & giving animated geo new normals for fur

Sometimes you want to reorient your normals on an object. However when you do it & it turns out that your object is animated, the new normals might not behave as expected. The normals are probably "swimming" and not following the verts/points as you'd expect.
This is because you generally want your animation done AFTER the modelling process and your new normals don't know anything about the transforms that have happened before. Simply timeshifting and attribute interpolating doesn't seem to work.

Fortunately there's a node called Attribute Reorient. It will reorient more than just normals, but so far this is the use I've had for it.

Oh - my problem was having a pre animated alembic. I wanted to alter the normals for fur direction purposes, but the pre-animation was making the normals & thus also the fur behaviour freak out. By using the Attribute Reorient to essentially force new normals onto the animated geo I sorted out my problem! WINNER.
*note* seems like it looks for the vectors in the points section..so make sure your stuff is there!

Attribute Interpolating UVs & things other than scattered points.

Creating "sourceprim" and "sourceprimuv" attributes for things other than scattered points. In the Houdini docs for the scatter node, there is a guide on getting your scattered points to follow animated/deforming geometry. The scatter node can generate the source primitive and it's uv attributes for you at the tick of a box. You then stick that into an attribute interpolate node and away you go.

However, if you want to interpolate something else like say..a colour attribute or a UV attribute, or something like that - then you'll have to create your own sourceprim and sourceprimuv.
Freeze your geo using a timeshift. Then just lay down a pointVOP, connect it to your geo & then plug the source (ie in the case of the scatter example, it's the object you want to stick to) into the second input.
Within the VOP make an XYZdist node and wire up P to the position input and the second input into the "file" . Create two bind exports and change the output names to sourceprim and sourceprimuv, making sure the data types are correct.
Finally just play around with the search distance in the XYZdist node so you get correct values. Jump out of the VOP and plug the appropriate bits into the Attribute Interpolate node. Adjust the settings to whatever you need (Vertex,point etc...) and everything should be good! You might have to change the pointVop to a vertexVop... too haha.

FLIP volume velocity field (again)

Create a VDB with desired turbulence/noise in whichever way you fancy. Make sure the vdb is called "vel". Keeps things neater..

Inside the FLIP autodopnetwork, use a Source Volume node to bring in your velocity vdb. Scale & Temperature can be ignored. Be sure to uncheck the velocity "mask" and set the volume operation to "add".


Monday 7 November 2016

Maya style FFD lattice

Hook up a Bound node to the geo you want to lattice. To this, add an Edit node - this will be the node you pull points about with. Create a Lattice node and plug the geo into the First tab, the bound into the 2nd and the Edit into the 3rd.
Might be an idea to copy the divisions of the bound into the Lattice's divisions.

*further note*
since the lattice is linked to the bounds of your object, it isn't ideal for dynamically changing objects - eg a fluid sim. In the case of this, you're better off creating a static lattice object that will deal with the shape of your object throughout it's simulation. I think.

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