Skip to content

Instantly share code, notes, and snippets.

@ncannasse
Created May 22, 2017 15:29
Show Gist options
  • Save ncannasse/d7a2daf844e3d547613ee6a0974e7f2c to your computer and use it in GitHub Desktop.
Save ncannasse/d7a2daf844e3d547613ee6a0974e7f2c to your computer and use it in GitHub Desktop.
class NormalShader2D extends hxsl.Shader {
static var SRC = {
@:import h3d.shader.Base2d;
@param var normalMap : Sampler2d;
function fragment() {
var n = unpackNormal(normalMap.get(calculatedUV));
var light = vec3(1,2,3).normalize();
var lum = light.dot(n).saturate();
pixelColor.rgb *= lum;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment