bjornbytes / shh

Spherical Harmonics Helpers
MIT License
3 stars 0 forks source link

Move evaluateSH() to lovr.glsl? #1

Open jmiskovic opened 5 months ago

jmiskovic commented 5 months ago

Maybe evaluateSH() (link) should be made a part of lovr.glsl? It would make it easy to integrate with custom shaders, since you rarely want just the light probe.

bjornbytes commented 5 months ago

There's shader.glsl in this repo that can be included to get the evaluateSH function. (The linked code doesn't use it because then the library would depend on an extra file and it's not clear what the include path should be).

LÖVR currently has an evaluateSphericalHarmonics function in shaders, but it only works with filament's pre-scaled coefficients so it won't work properly with these.

Given all that, it still might make sense to replace the evaluateSphericalHarmonics helper with this evaluateSH function because: A) it makes this library easier to use since you don't need to copy shader.glsl and B) it's confusing to have 2 different SH evaluators floating around.