This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
////////////////////////// | |
// -1 to 1 remap to 0 to 1 | |
////////////////////////// | |
x = x / 2 + 0.5; | |
////////////////////////// | |
// 0 to 1 remap to -1 to 1 | |
////////////////////////// |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//////////////////////////////////////////////////////// | |
// rotate a point around another point using quaternions | |
// set quaterion by vector | |
var quat = Quaternion.LookRotation(Vector3 forward, Vector3 upwards = Vector3.up); | |
// set quaternion by angle | |
var quat = Quaternion.AngleAxis(float angle, Vector3 axis); | |
// rotate around pivit point |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
float width = chf("width"); | |
float depth = chf("depth"); | |
float halfWidth = width * 0.5; | |
float halfDepth = depth * 0.5; | |
vector v0 = set( halfWidth, 0, halfDepth); | |
vector v1 = set(-halfWidth, 0, halfDepth); | |
vector v2 = set(-halfWidth, 0, -halfDepth); | |
vector v3 = set( halfWidth, 0, -halfDepth); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//////////////////////////////// | |
// houdini attributes and groups | |
//////////////////////////////// | |
/////////////////////// | |
// attributes as groups | |
// credit here: http://www.tokeru.com/cgwiki/?title=Houdini | |
// the below can be entered as expressions in any goup field | |
// not spaces, no semi colon, must be conditional, must be cast using "s, i, f", etc | |
// floats don't need casting |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/////////////////////////////////////////////// | |
// glsl snippets: credit given where i could // | |
/////////////////////////////////////////////// | |
/////////////////// | |
// inverse matrices | |
// credit to: https://github.com/glslify/glsl-inverse/blob/master/index.glsl | |
float inverse(float m) { | |
return 1.0 / m; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/////////////////////// | |
// houdini vex snippets | |
/////////////////////// | |
// get angle between two vectors ( 0 - 360 dergees ) | |
float angleBetween ( vector v1; vector v2 ) { | |
// define up vector | |
vector up = {0.0, 1.0, 0.0}; | |