playcanvas
Version:
PlayCanvas WebGL game engine
3 lines (2 loc) • 820 B
TypeScript
declare const _default: "\nuniform highp sampler2D sh_labels;\nuniform highp sampler2D sh_centroids;\n\nuniform float shN_mins;\nuniform float shN_maxs;\n\n// To support each SH degree, readSHData is overloaded based on the SH vector depth \n\nvoid readSHData(in SplatSource source, out vec3 sh[SH_COEFFS], out float scale) {\n // extract spherical harmonics palette index\n ivec2 t = ivec2(texelFetch(sh_labels, source.uv, 0).xy * 255.0);\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), texelFetch(sh_centroids, ivec2(u + i, v), 0).xyz);\n }\n\n scale = 1.0;\n}\n";
export default _default;