Monday 24 June 2019

FETCH inverting transforms at object level

Recently I transformed a camera (scaled and rotated) to make things easier to work with in Houdini.
I did this with nulls at object level, rather than within the SOP themselves.
However, when transferring my assets back to Maya there was no clear way to invert the transformation (like in the SOP level Transform nodes).

The answer to this, is to use a FETCH node (thanks Matt Evans), which I pointed toward my rotation null and I told it to invert.. This Fetch node was then plugged into the geometry I was trying to return to the original camera orientation/scale (as you would with a null).

basically!
SCALE NULL--->ROTATE NULL--->CAMERA

FETCH(points to ROTATE NULL,with invert ticked on)--->GEO


Wednesday 19 June 2019

rotate packed primitives/ WALTER ROTATE

how to rotate a/bunch of packed primitive/s -
Use a WALTER ROTATE.

in a primitive wrangle:


float randomFactor=rand(@primnum+2323)*chf("randomMult");
matrix3 rot = primintrinsic(0, "transform", @primnum);
vector4 orient = quaternion(rot);
vector x = normalize(qrotate(orient, {1,0,0}));
vector y = normalize(qrotate(orient, {0,1,0}));
rotate(rot, radians(chf("angle") * randomFactor), x);
rotate(rot, radians(chf("angley")), y);
setprimintrinsic(0, "transform", @primnum, rot);

//////////////////
what we are doing is:
  • making a random factor to multiply the rotations, using primnum as a seed
  • creating a matrix called "rot", and initialising it to the transform of the primitive
  • create a vector called "orient", using the quarternion of the rot matrix
  • create vectors x and y
  • rotate the rot matrix using input angles for x and y
  • then finally set the primitive intrinsic using the rot matrix