Skip to content

Instantly share code, notes, and snippets.

View larsberg's full-sized avatar
💭
Big up to my github brethren

Lars Berg larsberg

💭
Big up to my github brethren
View GitHub Profile
@patriciogonzalezvivo
patriciogonzalezvivo / GLSL-Noise.md
Last active March 2, 2025 12:08
GLSL Noise Algorithms

Please consider using http://lygia.xyz instead of copy/pasting this functions. It expand suport for voronoi, voronoise, fbm, noise, worley, noise, derivatives and much more, through simple file dependencies. Take a look to https://github.com/patriciogonzalezvivo/lygia/tree/main/generative

Generic 1,2,3 Noise

float rand(float n){return fract(sin(n) * 43758.5453123);}

float noise(float p){
	float fl = floor(p);
  float fc = fract(p);
@spite
spite / gist:9110247
Last active June 9, 2018 09:59
Pass Inverse of ModelView Matrix to Vertex Shader
/*
uniform types: https://github.com/mrdoob/three.js/wiki/Uniforms-types
THREE.Matrix4: http://threejs.org/docs/#Reference/Math/Matrix4
https://github.com/mrdoob/three.js/issues/1188
*/
/*
on Init();
Add this uniform to your uniforms
@jbenet
jbenet / simple-git-branching-model.md
Last active January 13, 2025 08:27
a simple git branching model

a simple git branching model (written in 2013)

This is a very simple git workflow. It (and variants) is in use by many people. I settled on it after using it very effectively at Athena. GitHub does something similar; Zach Holman mentioned it in this talk.

Update: Woah, thanks for all the attention. Didn't expect this simple rant to get popular.

@mjackson
mjackson / color-conversion-algorithms.js
Last active March 1, 2025 04:06
RGB, HSV, and HSL color conversion algorithms in JavaScript
/**
* Converts an RGB color value to HSL. Conversion formula
* adapted from http://en.wikipedia.org/wiki/HSL_color_space.
* Assumes r, g, and b are contained in the set [0, 255] and
* returns h, s, and l in the set [0, 1].
*
* @param Number r The red color value
* @param Number g The green color value
* @param Number b The blue color value
* @return Array The HSL representation
@mattebb
mattebb / gist:4545268
Last active December 11, 2015 04:28
Curl Noise (MEL)
// http://soup-dev.websitetoolbox.com/post/curl-noise-for-maya-5937312
pickWalk -d down;
string $part[] = `ls -sl`;
addAttr -ln "noiseFrequency" -at double3 $part[0];
addAttr -ln "noiseFrequencyX" -at double -p noiseFrequency $part[0];
addAttr -ln "noiseFrequencyY" -at double -p noiseFrequency $part[0];
addAttr -ln "noiseFrequencyZ" -at double -p noiseFrequency $part[0];
setAttr -type double3 ($part[0] + ".noiseFrequency") 0.4 0.4 0.4;
setAttr -e-keyable true ($part[0] + ".noiseFrequency");
@ofZach
ofZach / gitignore OF
Created September 12, 2012 14:41
good gitignore for OF
# Some general ignore patterns
build/
obj/
*.o
Debug*/
Release*/
*.mode*
*.app/
*.pyc
.svn/
@pwenzel
pwenzel / git-log-to-tsv.sh
Created June 6, 2012 20:53
Git Log to Tab-Delimited CSV File
# Local Dates:
git log --date=local --pretty=format:"%h%x09%an%x09%ad%x09%s" > commits.local.tsv.txt
# ISO Dates:
git log --date=iso --pretty=format:"%h%x09%an%x09%ad%x09%s" > commits.iso.tsv.txt
@chandlerprall
chandlerprall / ThreeBSP.js
Created December 16, 2011 05:22
Port of Evan Wallace's csg.js to Three.js
THREE.Vector3.prototype.lerp = function ( a, t ) {
return this.clone().addSelf( a.clone().subSelf( this ).multiplyScalar( t ) );
};
THREE.Vertex.prototype.interpolate = function( other, t ) {
var v = new THREE.Vertex( this.position.lerp( other.position, t ) );
v.normal = this.normal.clone();
return v;
};