Skip to content

Instantly share code, notes, and snippets.

View bhouston's full-sized avatar

Ben Houston bhouston

View GitHub Profile
#include <SPI.h>
#include <SD.h>
const int chipSelect = 4;
const int waterPumpRelayPin = 8;
const int moisture_minimum = 400;
const int watering_delay = 1000;
const int loop_delay_minutes = 5;
const int loop_delay = 60 * 1000 * loop_delay_minutes;
@bhouston
bhouston / MeshCurvature.cs
Created February 20, 2018 16:02
C# (C-Sharp) Mesh Curvature complete implementation.
// Ben Houston <[email protected]>
/*
Based upon:
Szymon Rusinkiewicz
Princeton University
TriMesh_curvature.cc
Computation of per-vertex principal curvatures and directions.
var shuffle = require('shuffle-array');
var PoissonDiskSampling = require('poisson-disk-sampling');
var p = new PoissonDiskSampling([1000, 1000], 100, 100, 10);
var points = p.fill();
for( i = 0; i < points.length; i ++ ) {
points[i][0] = Math.round( points[i][0] * 100 ) / (1000*100);
points[i][1] = Math.round( points[i][1] * 100 ) / (1000*100);
}
shuffle( points );
"#if MAX_AREA_LIGHTS > 0",
"for( int i = 0; i < MAX_AREA_LIGHTS; i ++ ) {",
"vec3 lPosition = ( viewMatrix * vec4( areaLightPosition[ i ], 1.0 ) ).xyz;",
//"vec3 lVector = lPosition.xyz + vViewPosition.xyz;",
"vec3 width = areaLightWidth[ i ];",
"vec3 height = areaLightHeight[ i ];",
@bhouston
bhouston / bprt_simplified_spec.txt
Created October 19, 2015 17:13
Simplified PBRT Specification
Utilities used by the BxDFs:
Fresnel functions:
FresnelDielectric( iorI, iorT )
FresnelConductor( iorI, iorT, kappa )
FresnelNoOp()
Microfacet distributions:
BeckmannDistribution ( uRoughness, vRoughness );
TrowbridgeReitzDistribution( uRoughness, vRoughness )
@bhouston
bhouston / mdl_specification_simplified.txt
Created October 19, 2015 17:09
MDL Specification Simplified
// source: http://www.mdlhandbook.com/pdf/mdl_handbook.150810.LTR.pdf
// Material definition:
- Surface properties of front-facing surfaces
- Reflection
- Transmission
- Emission
- Surface properties of back-facing surfaces
- Reflection
@bhouston
bhouston / gist:1dc2a760783314b95bd9
Created April 24, 2015 19:30
Scalable Ambient Obsurance for ThreeJS.
/**
* @author bhouston / http://clara.io/
*
* Scaleable Ambient Obscurance
*
* based on:
* - https://gist.github.com/fisch0920/6770311
* - http://graphics.cs.williams.edu/papers/SAOHPG12/McGuire12SAO-talk.pdf
*/
@bhouston
bhouston / WebGLLowLevelRenderer-Test.js
Created April 14, 2015 14:00
WebGLLowLevelRenderer-Test.js
var gl;
function initGL(canvas) {
try {
gl = WebGLDebugUtils.makeDebugContext( canvas.getContext("webgl"), undefined,
function(functionName, arguments) {
console.log( " [webgl] " + functionName.toString() + "( ", arguments, " )" );
} );
gl.viewportWidth = canvas.width;
gl.viewportHeight = canvas.height;
}
@bhouston
bhouston / WebGLLowLevelRenderer.js
Created April 14, 2015 14:00
WebGLLowLevelRenderer.js
THREE.Assert = function( mustBeTrue, message ) {
if( ! mustBeTrue ) throw new Error( message | "Assertion failure." );
}
THREE.Descriptor = function ( elementType, itemSize, isArray, isIndex ) {
THREE.Descriptor.AssertElementType( elementType );
this.itemSize = itemSize;
this.elementType = elementType;
Error #1:
(unknown): Unable to get value of the property 'toUpperCase': object is null or undefined
Location: https://cdn.webglstats.com/stat.js line 8
Browser: IE 9.0
OS: Windows Vista
Error #2:
(unknown): Error loading script