playcanvas
Version:
PlayCanvas WebGL game engine
4 lines (2 loc) • 474 B
JavaScript
var ambientEnvPS = "\n#ifndef ENV_ATLAS\n#define ENV_ATLAS\nuniform sampler2D texture_envAtlas;\n#endif\nvoid addAmbient(vec3 worldNormal) {\n vec3 dir = normalize(cubeMapRotate(worldNormal) * vec3(-1.0, 1.0, 1.0));\n vec2 uv = mapUv(toSphericalUv(dir), vec4(128.0, 256.0 + 128.0, 64.0, 32.0) / atlasSize);\n vec4 raw = texture2D(texture_envAtlas, uv);\n vec3 linear = $DECODE(raw);\n dDiffuseLight += processEnvironment(linear);\n}\n";
export { ambientEnvPS as default };