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

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)

Tuesday 27 September 2016

Snap surface points to another mesh, based on distance

Eg. When you have a simmed fluid not quite sitting on it's collision surface/ intersecting & you want it to be fixed/better.

Using a Point Vop. Plug in the surface and it's "collider".
Drop down a xyzdist plug that into a primitive normal. Hook up the appropriate inputs, don't for the the "file" input in the primitive normal. Set the max search distance to something sensible (probably a small value)

Plug the resultant "dist" from the xyzdist into a fit range node and promote the max value to the object level. In the destination value, set the min to 1 and the max to 0. Multiply this by the distance to avoid affecting the entire object (the max value will clamp a lot of values to 0 and nullify it)

Plug things into a displace along normal node. Promote the scale value. Finally connect the final P value.

It's worth having a group node with bounding points to check how well it's all worked.

Monday 26 September 2016

sticky fields Houdini

Enable Sticky in the Flip Solver.
Create sticky attributes using point wrangle (f@stick=1;) and paint (replace Cd with stick).
VDB from polygons, using the attribute at the bottom of the node.

in the flip solver, add a SOP-scalar-field node and change the data at the bottom to "stick".

Thursday 22 September 2016

bounding box group node for faster VDB meshing

Group points, turn off numeric, enable bounding points & change bounding type to points only.
Blast away particles before VDB evaluation to save on computation time.

Tuesday 20 September 2016

particle velocity to VDB fog/volume

particles, run a pointVop taking length of velocity and fit ranging them (min max to 0 and 1)
Plug new values into pscale.

VDB from particles, select fog, set minimum particle radius to 0.

should have a VDB mask ready for the faster parts of the sim.