Skip to content

Instantly share code, notes, and snippets.

View bhouston's full-sized avatar

Ben Houston bhouston

View GitHub Profile
@bhouston
bhouston / normalmap.fragment.glsl
Last active June 3, 2020 11:37
Original normalmap fragment shader - auto-formatted
uniform vec3 ambient;
uniform vec3 diffuse;
uniform vec3 specular;
uniform float shininess;
uniform float opacity;
uniform bool enableDiffuse;
uniform bool enableSpecular;
uniform bool enableAO;
uniform bool enableReflection;
uniform sampler2D tDiffuse;
@bhouston
bhouston / common.glsl
Created January 7, 2014 17:34
Common.glsl so far
vec4 inputGamma( const in vec4 input_rgba ) {
#ifdef GAMMA_INPUT
vec4 output_rgba = input_rgba;
output_rgba.xyz * output_rgba.xyz;
return output_rgba;
#else
return input_rgba;
#endif
@bhouston
bhouston / normalmap.fragment.glsl
Created January 7, 2014 17:35
Partially refractored normalmap.fragment.glsl
uniform vec3 ambient;
uniform vec3 diffuse;
uniform vec3 specular;
uniform float shininess;
uniform float opacity;
uniform bool enableDiffuse;
uniform bool enableSpecular;
uniform bool enableAO;
uniform bool enableReflection;
uniform sampler2D tDiffuse;
class OStream::PrivateData
{
private:
char filestreamBuffer[STREAM_BUF_SIZE];
public:
PrivateData(const std::string & iFileName) :
stream(NULL), fileName(iFileName), startPos(0)
{
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
@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;
@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 / 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 / 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 / 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 )