@animech-public/playcanvas
Version:
PlayCanvas WebGL game engine
16 lines (14 loc) • 462 B
JavaScript
var ambientEnvPS = `
uniform sampler2D texture_envAtlas;
void addAmbient(vec3 worldNormal) {
vec3 dir = normalize(cubeMapRotate(worldNormal) * vec3(-1.0, 1.0, 1.0));
vec2 uv = mapUv(toSphericalUv(dir), vec4(128.0, 256.0 + 128.0, 64.0, 32.0) / atlasSize);
vec4 raw = texture2D(texture_envAtlas, uv);
vec3 linear = $DECODE(raw);
dDiffuseLight += processEnvironment(linear);
}
`;
export { ambientEnvPS as default };