# all files / src/shader/source/deferred/ ambientcubemap.glsl.js

100% Statements 1/1
100% Branches 0/0
100% Functions 0/0
100% Lines 1/1

    1
    21×
     export default "@export clay.deferred.ambient_cubemap_light\n@import clay.deferred.chunk.light_head\nuniform vec3 lightColor;\nuniform samplerCube lightCubemap;\nuniform sampler2D brdfLookup;\nuniform vec3 eyePosition;\n@import clay.util.rgbm\nvoid main()\n{\n    @import clay.deferred.chunk.gbuffer_read\n    vec3 V = normalize(eyePosition - position);\n    vec3 L = reflect(-V, N);\n    float ndv = clamp(dot(N, V), 0.0, 1.0);\n    float rough = clamp(1.0 - glossiness, 0.0, 1.0);\n    float bias = rough * 5.0;\n    vec2 brdfParam = texture2D(brdfLookup, vec2(rough, ndv)).xy;\n    vec3 envWeight = specularColor * brdfParam.x + brdfParam.y;\n    vec3 envTexel = RGBMDecode(textureCubeLodEXT(lightCubemap, L, bias), 51.5);\n    gl_FragColor.rgb = lightColor * envTexel * envWeight;\n    gl_FragColor.a = 1.0;\n}\n@end";