playcanvas
Version:
Open-source WebGL/WebGPU 3D engine for the web
30 lines (27 loc) • 952 B
JavaScript
var bakeLmEnd_default = (
/* glsl */
`
// diffuse light stores accumulated AO, apply contrast and brightness to it
// and multiply ambient light color by the AO
dDiffuseLight = ((dDiffuseLight - 0.5) * max(ambientBakeOcclusionContrast + 1.0, 0.0)) + 0.5;
dDiffuseLight += vec3(ambientBakeOcclusionBrightness);
dDiffuseLight = saturate(dDiffuseLight);
dDiffuseLight *= dAmbientLight;
// encode to RGBM
gl_FragColor.rgb = dDiffuseLight;
gl_FragColor.rgb = pow(gl_FragColor.rgb, vec3(0.5));
gl_FragColor.rgb /= 8.0;
gl_FragColor.a = clamp( max( max( gl_FragColor.r, gl_FragColor.g ), max( gl_FragColor.b, 1.0 / 255.0 ) ), 0.0,1.0 );
gl_FragColor.a = ceil(gl_FragColor.a * 255.0) / 255.0;
gl_FragColor.rgb /= gl_FragColor.a;
gl_FragColor = vec4(dDiffuseLight, 1.0);
`
);
export {
bakeLmEnd_default as default
};