Tuesday, 29 October 2024

killing arnold in linux

sometimes arnold will freeze on you in houdini...
In Linux, open up a new terminal and type -

and maybe, just maybe you'll be able to get Houdini to respond again.


 killall hick-bin will also work

 

pkill hick

 

Monday, 7 October 2024

random spin to particles/packed rigid bodies

stolen from a Toadstorm reply somewhere...

axis might be more finessed than just setting to z as shown.. Same goes for the angle, which I've brute forced to -90 times. Anyway, this will give a bit of spin to your packed rigid bodies


vector axis = set(0,0,1); // the random axis attribute you created

float angle = -90*fit01(rand(@ptnum), -1, 1); // change this to whatever range, in radians

vector4 q = quaternion(angle, axis);

v@w = qconvert(q);


Monday, 30 September 2024

solver storing the frame when attribute changes

 


Say you're transferring an attribute to an object. Eg. a sphere going along a curve and making it red.

Now you might want to store the frame that the curve receives the red attribute and use that information later - eg. do an attribute fade, so the attrib only starts fading when we reach the stored frame.

What you want to do is plug things into a solver, as above (just one input) and then....



in a wrangle-

vector newCd=point(1,"Cd",@ptnum);


if(@Cd!=newCd){

    if(@change_frame==0){

    @change_frame=@Frame;

    //i@changed += 1; //debugging

    }

    

}


What does this mean? Well, the Prev Frame is typically on the first input of point wrangles when in a solver... you are generally "adding" onto whatever was in the previous frame. (I always think about it the other way, but there you go). So we check to see what the "new" (or current frame) Cd value is.. And compare it to the existing (previous frame) value. If it is not the same, that means a change has occurred.

Now we check to see if the @change_frame value has been altered from zero or not. If it hasn't and is still zero, then we now make it equal to the current frame value.

Tuesday, 24 September 2024

solver transfer attribute, eg. colour accumulation

i always have to look this up on cgwiki...

the left stream is some sweat drops falling down a surface.. the right stream is the surface. 

It goes into a solver









The slight 0.0075 blend in the blendshape causes a slight fade of the attribute being transferred. Leaving it at zero will result in an absolute solver-accumulation of the value.

Thursday, 12 September 2024

bringing object to origin

Not entirely sure how this deals with objects that move around A LOT, but for something mostly static that isn't near the origin it's good. Useful for simming stuff at zero then shoving back to where it came from.


In a point wrangle, move object to 0.0.0..

 // Get center of the oject bounding box (centroid)

vector min = {0, 0, 0};

vector max = {0, 0, 0};

getpointbbox(0, min, max);

vector centroid = (max + min)/2.0;


// Build and apply transformation matrix

vector translate = centroid + {0,-0.2,0};

vector rotate = {0,0,0};

vector scale = {1,1,1};

matrix xform = invert(maketransform(0, 0, translate, rotate, scale));

@P *= xform;


// Store transformation matrix in attribute

4@xform_matrix = xform;




Then in a later point wrangle, to revert back to original position


@P *= invert(4@xform_matrix);

Wednesday, 11 September 2024

queuing rops (for local renders)

 it seems like chaining rops breaks a bit - the frame ranges don't seem to get respected.

It's better to use a merge rop & specify strict frame range





Wednesday, 28 August 2024

mark fancher mograph video notes

 some mark fancher youtube vex tidbits-

//in a rig attrib wrangle, to rotate joints - take into account parenting!-

vector axis={1,0,0};

prerotate(4@localtransform, chf("angle"),axis);

-----------------------------------------------------------------------------------------

//in a rig attrib wrangle,to scale joints - take into account parenting-

prescale(4@localtransform, chf("scale"));



--------------------------------------------------------------------------------------------------------

//point wrangle, after a distance along geometry - nice rampable normalised mask

float map=f@map;

float p=chf("position");

float t=chf("transition");

t=max(t,0.0001); //clamps down value

p=fit01(p,-t,1); //makes mask zero when t at low values and p at zero

float mask=fit(map,p,p+t,1,0);

mask=chramp("ramp",mask);

f@mask=mask;

--------------------------------------------------------------------------------------------

how to store activation frame based on a threshold of something

in a point wrangle

if(@value>chf("threshold")){

i@group_active=1;

}

inside a solver...connect prev_frame to input 2 and input 1 to 1 of a point wrangle..

int prev_active=inpointgroup(1,"active",@ptnum); //check if previous frame was active

//if group active and NOT previously active then give active_frame value of current frame

if(i@group_active==1 && prev_active==0){

f@active_frame=@Frame;

}


float activationFramePrevious=point(1,"active_frame",@ptnum);

f@active_frame=max(activationFramePrevious, @active_frame);



simple spring solver - prev frame into input 1, input 1 into 2nd input of wrangle

based on F=-kx -bv

where F is force, k is the spring coefficient (stiffness), x is the distance, b is the damping and v is velocity. We also use F=ma to calculate acceleration (and use that for velocity, which ultimately gets added to Position)

float m=chf("mass");

float k=chf("stiffness");//stiffness coefficient

float b=chf("damping");//damping coefficient


vector p2=point(1,"P",@ptnum);//position of point on "current" frame

vector x=@P-p2; //distance between previous and current

vector f=-k*x -b*v@_v;//calculate force using damped harmonic motion equation


vector a =f/m; //get acceleration from f=ma to then find...

v@_v+=a;//velocity

v@P+=v@_v;//new position is calculated by adding velocity vector to current pos

Tuesday, 27 August 2024

creating orient and rotating points around vector

I think Toadstorm posted this somewhere on odforce... but it's a useful little vex snippet


 vector fwd = v@N;

vector up = {0,1,0};
// if you don't have a defined up vector but want to compute one the way houdini does it natively,
// compute the rotation that rotates +Z to N and apply this to +Y...
// matrix3 d = dihedral({0,0,1}, fwd);
// up = normalize(d * up);matrix3 m = maketransform(fwd, up);
// now you can rotate this around whatever axis you want.
vector axis = normalize(chv("axis")); // or use an existing vector attribute!
float angle = @noiseVal*radians(ch("angle")); // or use a random float attribute!
rotate(m, angle, axis);// now convert this rotated matrix to a quaternion and bind to p@orient. copy to points and/or DOPs will understand this.
@orient = quaternion(m);

Monday, 19 August 2024

houdini's unlock normals....

an equivalent to maya's "unlock normals" in houdini.. usually needed after a polyextrude -

 reverse sop node, followed by a normal node

Tuesday, 30 July 2024

notes - christopher rutledge kinefx videos

general character rig workflow -

exoside quad remesh

labs 3d straight skeleton, fuse, delete half (for mirroring), resample.

use cgwiki matt estela's edge transport distance attrib propogate trick to reorder vert numbers

(edge transport "(distance)", promote to primitive (don't delete origintal), sort by distance, polypath)

rig doctor

mirror rig

joint capture biharmonic for mesh capture. joint capture paint to tweak any specific weights

stash captured geo and skele, externally(!)

plug all into joint deform.


rig wrangle to use curl noise vector attrib to mess with joint rotation/scale/pos.

he sets poses with multiple rig pose nodes. Then switch-nodes between them using a $F and modulo expression. This is nice for stepped anim style, but if you want to inbetween them,

Use a "smooth motion" node. It's used for fixing jittery mocap - but it also provides a nice tween between the different rig poses.

Another novel blending approach is to put the step anim through a solver. Inside the solver use a skeleton blend with the previous frame, using a blend value of less-than-one, for an interesting ramped blend between poses.
This can also be used with stepped blend shapes(eg for a stepped mountain sop anim). Smooth motion seems to have some nice secondary motion built in.


There is a secondary motion sop node which lets you specify a driver joint & the group to affect. Typically these will be joints down the hierarchy, eg in a tail/whip/arm. Also has some effect features - lag/overshoot, jiggle and gravity.




Tuesday, 23 July 2024

Monday, 22 July 2024

USD write .usd but in ascii

.usd files are written as binary by default. to write a .usd file as ascii, add
":SDF_FORMAT_ARGS:format=usda" (without quotes) directly after the file name.



eg.
$HIP/usd/$HIPNAME/scenes/extensions/extension_scene_ascii.usd:SDF_FORMAT_ARGS:format=usda

Wednesday, 29 May 2024

getting distance to object in camera

 vlength(vtorigin(".","../FOCUS_MAN"))


paste this into the Focus Distance parameter, replacing FOCUS_MAN with whichever object/null you're following.

Monday, 29 April 2024

padding zeroes in vex

 s@frameNum= sprintf('%04d',clamp((@Frame-1000),0,68));

//s@name = sprintf('%04d',@Frame);

s@textureFile=chs("part1")+@frameNum+chs("end");


slight update on zero padding in vex...

use sprintf to reformat numbers..

Tuesday, 23 April 2024

Thursday, 11 April 2024

culling stuff camera

 string camera=chs("../camera");

vector campos=toNDC(camera,@P);



vector2 padding =chu("../padding");


if((campos.x+padding.x)<0||(campos.x-padding.x)>1||(campos.y+padding.y)||(campos.y-padding.y)){

        i@group_kill=1;}


matrix cam=optransform(camera);


vector camera_position=cracktransform(0,0,0,{0,0,0}, cam);


float distance =distance (camera_position,@P);


float threshold=chf("../distance");

if(distance>threshold){

        i@group_kill=1;}

Tuesday, 9 April 2024

instance ass files (not paths)

use instancefile to access geo saved somewhere...

in a point wrangle - 


  s@instancefile=chs("path");


now with the geo node, you gotta add the instance tab and turn on fast instancing.





Wednesday, 20 March 2024

resource - projecting curve onto heightfield with control

 Projecting a Road Curve onto a Heightfield - procegen - Procedural Content Generation (konstantinmagnus.de)


some of the newer tools in Houdini might do this, but it's quite nice to see how to do it manually.

point wrangle the curve, with heightfield in input 1..

float lift = chf('lift'); f@height = volumesample(1, 'height', v@P) + lift;


then plug that into a volume wrangle (input 1), heightfield in input 0 

float width_min = chf('min_width'); float width_max = chf('max_width'); float ease = chf('roll_off'); int prim; vector uvw; float dist_crv = xyzdist(1, v@P, prim, uvw); float height_crv = primuv(1, 'height', prim, uvw); float mask = 1.0 - smooth(width_min, width_max, dist_crv, ease); f@height = lerp(f@height, height_crv, mask); f@mask = mask;


You can control the height with the "lift" slider made in the point wrangle, and the width/falloff in the sliders made in the volume wrangle.

Friday, 2 February 2024

simple rigging setups using kinefx

 

typical basic kinefx rigging for organicish shapes


simple rigid body FK rig. Key points are packing each rigid part, and using the capture packed geo node. make sure the skeleton points are at the desired pivot points.


basic setup here - line as a skeleton, isolate the FBIK controller points. the MATCH BY ATTRIBUTE setting is usually what makes things work! Also on the FBIK node, you might need to tweak the tolerance parameter.

look at constraint but only in the X or Y etc

 


There's a Look At Constraint, in the Constraints tab, however if you only want this aim to work on the X, or maybe just the Y, you have to dig into the constraint, then go to the Common Tab (see top screenshot) and then only specify the rx or ry in the scope.

Remember to use Nulls to set custom pivots etc, then parent your desired geometry to the null.