Skip to content

Commit

Permalink
Model Renderer: Added "uAlphaLimit" variable to the generic model shader
Browse files Browse the repository at this point in the history
  • Loading branch information
skyjake committed Sep 6, 2015
1 parent 3666c37 commit 3fae774
Showing 1 changed file with 5 additions and 2 deletions.
Expand Up @@ -71,6 +71,7 @@ model {
uniform highp vec4 uAmbientLight;
uniform highp vec4 uLightIntensities[4];
uniform highp float uEmission;
uniform highp float uAlphaLimit; // alpha test to discard fragments

varying highp vec2 vUV;
varying highp vec4 vUVBounds[4];
Expand Down Expand Up @@ -148,8 +149,10 @@ model {

highp vec4 emission = uEmission * texture2D(uTex, emissiveUV);

gl_FragColor.rgb += specular.rgb + (emission.rgb * emission.a);
gl_FragColor.a = min(1.0, diffuse.a + specular.a + emission.a);
gl_FragColor.rgb += specular.rgb + emission.rgb;
gl_FragColor.a = min(1.0, diffuse.a + specular.a);

if(gl_FragColor.a < uAlphaLimit) discard;
}"
}
}

0 comments on commit 3fae774

Please sign in to comment.