playcanvas
Version:
Open-source WebGL/WebGPU 3D engine for the web
3 lines (2 loc) • 689 B
TypeScript
declare const _default: "\n#if SH_BANDS > 0\nuniform highp sampler2D packedShN;\n\nuniform float shN_mins;\nuniform float shN_maxs;\n\nvoid readSHData(out vec3 sh[SH_COEFFS], out float scale) {\n // extract spherical harmonics palette index\n ivec2 t = ivec2(packedSample.xy & 255u);\n int n = t.x + t.y * 256;\n int u = (n % 64) * SH_COEFFS;\n int v = n / 64;\n\n // calculate offset into the centroids texture and read consecutive texels\n for (int i = 0; i < SH_COEFFS; i++) {\n sh[i] = mix(vec3(shN_mins), vec3(shN_maxs), unpack111110(pack8888(texelFetch(packedShN, ivec2(u + i, v), 0))));\n }\n\n scale = 1.0;\n}\n#endif\n";
export default _default;