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.