playcanvas
Version:
PlayCanvas WebGL game engine
3 lines (2 loc) • 1.69 kB
TypeScript
declare const _default: "\n\n#if LIGHT_TYPE != DIRECTIONAL\n uniform vec3 view_position;\n uniform float light_radius;\n#endif\n\n#if SHADOW_TYPE == PCSS_32F\n #include \"linearizeDepthPS\"\n#endif\n\nvoid main(void) {\n evaluateFrontend();\n\n // using non-standard depth, i.e gl_FragCoord.z\n #ifdef PERSPECTIVE_DEPTH\n float depth = gl_FragCoord.z;\n\n #if SHADOW_TYPE == PCSS_32F\n // spot/omni shadows currently use linear depth.\n // TODO: use perspective depth for spot/omni the same way as directional\n #if LIGHT_TYPE != DIRECTIONAL\n depth = linearizeDepth(depth, camera_params);\n #endif\n #endif\n\n #else\n float depth = min(distance(view_position, vPositionW) / light_radius, 0.99999);\n #define MODIFIED_DEPTH\n #endif\n\n #if SHADOW_TYPE == VSM_16F || SHADOW_TYPE == VSM_32F\n #if SHADOW_TYPE == VSM_32F\n float exponent = 15.0;\n #else\n float exponent = 5.54;\n #endif\n depth = 2.0 * depth - 1.0;\n depth = exp(exponent * depth);\n gl_FragColor = vec4(depth, depth*depth, 1.0, 1.0);\n #else\n #if SHADOW_TYPE == PCSS_32F\n // store depth into R32\n gl_FragColor.r = depth;\n #else\n #ifdef MODIFIED_DEPTH\n // If we end up using modified depth, it needs to be explicitly written to gl_FragDepth\n gl_FragDepth = depth;\n #endif\n\n // just the simplest code, color is not written anyway\n gl_FragColor = vec4(1.0);\n #endif\n #endif\n}\n";
export default _default;