top of page

Useful Houdini VEX Code Snippets

Make Camera focus on a group called focus_cam - vlength(vtorigin(".", "../cam_focus"))

[input into focus distance attr of camera]


Vortex Vex Code

float angle = radians(ch("angle")) * length(@P*{1,0,1}) * relbbox(0, @P).y;

vector newPos = qrotate(quaternion(angle, {0,1,0}), @P);

@density = volumesample(0,0,newPos);

Delete by nearpoints

float maxdist = chf("max_dist");

f@nearpt = nearpoint(1,@P,maxdist);

f@test = maxdist;

if(@nearpt > -1){

removepoint(0,@ptnum);

}

Find Min and Max value of an attribute

float value;

float values[];

string attrname = "id";

float max_value;

float min_value;

for (int i=0; i<@numpt; i++){

value = point(geoself(), attrname, i);

append(values,value);

}

min_value = min(values);

max_value = max(values);

Attribute Randomize by Power (Powerful)


i@id = @ptnum+1;

float pts = @id;

float distro = pow(chramp("distro",rand(pts+chi("seed"))),ch("pow"));

float distro2 = pow(chramp("distro_pieces",rand(pts+chi("seed"))),ch("pow"));

float d = fit(distro,0,1,ch("pscaleMin"),ch("pscaleMax")) * ch("mult");

float d2 = fit(distro2,0,1,ch("pscaleMin"),ch("pscaleMax")) * ch("mult");

f@pscale = d;

i@copyPiece = rint(fit(d2,0,1,0,2));

//rotate object using VEX

matrix m = ident();

rotate(m, radians(chf("angle")), {1, 0, 0});

@P *= m;

Noise from a null (Hscript)

if ($F>1080 && $F<1095, snoise($FF+10,$FF,$FF)*1, 0) - input into rotation of null and attach to camera


3 views0 comments
bottom of page