Skip to content

Instantly share code, notes, and snippets.

@bassemhermina
bassemhermina / billboard_hbao.frag
Created November 15, 2016 17:00 — forked from transitive-bullshit/billboard_hbao.frag
WebGL GLSL HBAO (Horizon-Based Ambient Occlusion) fragment shader. HBAO is a higher quality approach for computing SSAO (Screen-Space Ambient Occlusion) developed by Nvidia in 2008. Converts the g-buffer to an occlusion buffer which estimates local ambient occlusion at each fragment in screen-space. Specifically, the technique views the depth bu…
// number of directions to sample in UV space
#define NUM_SAMPLE_DIRECTIONS {{ numSampleDirections }}
// number of sample steps when raymarching along a direction
#define NUM_SAMPLE_STEPS {{ numSampleSteps }}
#define APPLY_ATTENUATION {{ attenuation }}
#define USE_ACTUAL_NORMALS {{ useActualNormals }}
@bassemhermina
bassemhermina / pbr.glsl
Created November 15, 2016 16:56 — forked from galek/pbr.glsl
PBR GLSL SHADER
in vec2 v_texcoord; // texture coords
in vec3 v_normal; // normal
in vec3 v_binormal; // binormal (for TBN basis calc)
in vec3 v_pos; // pixel view space position
out vec4 color;
layout(std140) uniform Transforms
{
mat4x4 world_matrix; // object's world position