Skip to content

Instantly share code, notes, and snippets.

// Base Functions
function int Mandel(float x0, y0, z0; int imax) {
float x, y, z, xnew, ynew, znew;
int i;
x = x0;
y = y0;
z = z0;
@werediver
werediver / resample_rlen.vex
Created October 10, 2020 15:22
Houdini VEX code to resample a (two point) curve into segments of random length (with restrictions)
// Resample into segments of random length
// Run over primitives
float seed = chf("seed");
float seg_len_min = chi("seg_len_min");
float seg_len_max = chi("seg_len_max");
float seg_padding = chf("padding");
if (seg_len_min <= 0 || seg_len_max < seg_len_min || seg_padding < 0) {
error("Make sure 0 < seg_len_min <= seg_len_max and 0 <= seg_padding");
@BigRoy
BigRoy / alembic_has_any_shapes.py
Last active May 20, 2024 20:31
Python script using Alembic api to detect whether an .abc file contains any shapes.
import alembic
def any_shapes_in_alembic(filename):
"""Return whether Alembic file contains any shape/geometry.
Arguments:
filename (str): Full path to Alembic archive to read.
Returns:
bool: Whether Alembic file contains geometry.
@Kif11
Kif11 / align_to_normal.vex
Last active May 20, 2024 20:31
Rotate flat geometry to X/Z plane. Houdini VEX.
// Align object to target vector base on selected normal
// Useful when object has some weird orientation baked
// in the mesh and you wan to straighten it up.
// Point with normal from second wrangler input to align
vector from = point(1, 'N', 0);
// Allign "from" normal to the following vector
vector to = {0,1,0};
@Flafla2
Flafla2 / Perlin_Tiled.cs
Last active March 10, 2025 04:54
A slightly modified implementation of Ken Perlin's improved noise that allows for tiling the noise arbitrarily.
public class Perlin {
public int repeat;
public Perlin(int repeat = -1) {
this.repeat = repeat;
}
public double OctavePerlin(double x, double y, double z, int octaves, double persistence) {
double total = 0;
@fredrikaverpil
fredrikaverpil / get_set_values.py
Last active May 20, 2024 20:31
Get and set knob values #nuke
# Get all nodes of type Read
readnodes = nuke.allNodes('Read')
for readnode in readnodes:
print readnode
# List all knobs for selected node
print( nuke.toNode('Read1') )
# List all knobs for specific node
print( nuke.selectedNode() )