UNPKG

playcanvas

Version:

Open-source WebGL/WebGPU 3D engine for the web

28 lines (27 loc) 719 B
var sogSH_default = ` #if SH_BANDS > 0 #ifndef SOG_V2 uniform float shN_mins; uniform float shN_maxs; #endif void readSHData(out vec3 sh[SH_COEFFS], out float scale) { vec4 labels = texelFetch(sh_labels, splat.uv, 0); int n = int(labels.x * 255.0 + 0.5) + int(labels.y * 255.0 + 0.5) * 256; int u = (n % 64) * SH_COEFFS; int v = n / 64; for (int i = 0; i < SH_COEFFS; i++) { vec4 t = texelFetch(sh_centroids, ivec2(u + i, v), 0); #ifdef SOG_V2 ivec3 idx = ivec3(t.xyz * 255.0 + 0.5); sh[i] = vec3(lutShN(idx.x), lutShN(idx.y), lutShN(idx.z)); #else sh[i] = mix(vec3(shN_mins), vec3(shN_maxs), t.xyz); #endif } scale = 1.0; } #endif `; export { sogSH_default as default };