Skip to content

Instantly share code, notes, and snippets.

View mimetaur's full-sized avatar

Nathan Koch mimetaur

View GitHub Profile
[Ll]ibrary/
[Tt]emp/
[Oo]bj/
[Bb]uild/
[Bb]uilds/
Assets/AssetStoreTools*
# Visual Studio 2015 cache directory
/.vs/
import random
# script globals
normal_distribution_amount = 12
min_height = 1
max_height = 10
def get_random_height():
random_height = hou.hmath.fit(random.random(), 0, 1, min_height, max_height)
return random_height
(fit(rand($PT*0.77), 0, 1, 1, 10) + fit(rand($PT*0.97), 0, 1, 1, 10) + fit(rand($PT*0.778), 0, 1, 1, 10) + fit(rand($PT*0.17), 0, 1, 1, 10) + fit(rand($PT*0.37), 0, 1, 1, 10)) / 5
@mimetaur
mimetaur / noise_in_houdini_vex.vfl
Created June 17, 2018 23:01
Example of manipulating geometry with Houdini VEX
// using houdini's built in noise functions
// in the VEX expression language
// http://www.sidefx.com/docs/houdini/vex/index.html
// this is a Point Wrangle, meaning this code will be called
// for every point in the geometry
// each time it is called @P is equal
// to a different point in the geo
// params are located on the attribute wrangle
@mimetaur
mimetaur / exploding_tori.vfl
Created June 18, 2018 20:11
contents of week 02 / sketch 07 / attributewrangle1
int seed = set(ch("seed"));
float strength = ch("strength");
// trying out smoothing between two random values
float smoothedRand = smooth(random(seed + @pointnum),random(seed + @pointnum+1), 0.5);
// moving random from 0 to 1 to -0.5 to 0.5
float equalized = 0.5 -smoothedRand;
// y pos displaced based to rand * strength param
@mimetaur
mimetaur / create_points.c
Created June 19, 2018 22:40
Sketch 1 / Create Points Attribute Wrangle
// paramaters come in as floats by default
// in order to cast them to other types
// need to wrap them in a "set()"
int width = set(ch("width"));
int height = set(ch("height"));
int num_points = set(ch("num_points"));
int seed = set(ch("seed"));
// seed needs to be persisted
@mimetaur
mimetaur / create_points.c
Created June 19, 2018 22:50
Sketch 4 / Create Points Attribute Wrangle
u@startpos = chu("startpos");
u@endpos = chu("endpos");
f@increment = ch("increment");
for (float n = 0; n < 1; n += @increment)
{
float x = lerp(@startpos.x, @endpos.x, n);
float y = lerp(@startpos.y, @endpos.y, n);
vector position = set(x , 0, y);
@mimetaur
mimetaur / animate_points.c
Last active June 19, 2018 23:06
Sketch 4 / Animate Points Attribute wrangle
float amplitude = ch("amp");
float amp_scale = ch("amp_scale");
float noise_freq = ch("noise_freq");
float noise_offset = ch("noise_offset");
float time_speed = ch("time_speed");
for(float n = 0; n < 1; n += @increment)
{
@mimetaur
mimetaur / noise_cull.c
Created June 19, 2018 22:54
Sketch 5 / Noise Cull Attribute Wrangle
float noise_freq = ch("noise_freq");
float threshold = ch("threshold");
vector seed = @P * noise_freq;
// let downstream nodes access this value
f@noiseval = noise(seed);
if (@noiseval < threshold) {
removepoint(0, i@ptnum);
@mimetaur
mimetaur / noise_displacement.c
Created June 19, 2018 23:00
Sketch 6 / Noise displacement wrangle
float noise_freq = ch("noise_freq");
float strength = ch("strength");
vector2 noise_offset = chu("noise_offset");
float time_speed = ch("time_speed");
float x_noise = (@P.x * noise_freq) + (@Time * time_speed) + noise_offset.x;
float z_noise = (@P.z * noise_freq) + (@Time * time_speed) + noise_offset.y;
vector noise_seed = set(x_noise, 0, z_noise);
// let downstream nodes access this value