@:directlyUsed@:src({
@global var shadow:{ var map : Channel; var proj : Mat3x4; var color : Vec3; var power : Float; var bias : Float};
var pixelColor:Vec4;
var transformedPosition:Vec3;
var pixelTransformedPosition:Vec3;
@private var shadowPos:Vec3;
function fragment() {
var shadowPos = pixelTransformedPosition * shadow.proj;
var depth = shadow.map.get(screenToUv(shadowPos.xy));
var zMax = shadowPos.z.saturate();
var delta = (depth + shadow.bias).min(zMax) - zMax;
var shade = exp(shadow.power * delta).saturate();
pixelColor.rgb *= (1 - shade) * shadow.color.rgb + shade;
};
})@:build(hxsl.Macros.buildShader())@:autoBuild(hxsl.Macros.buildShader())