Skip to content

Fix spherical harmonics basis normalization - #499

Open
deepanshupal wants to merge 3 commits into
NVIDIAGameWorks:masterfrom
deepanshupal:master
Open

deepanshupal wants to merge 3 commits into
NVIDIAGameWorks:masterfrom
deepanshupal:master

Conversation

@deepanshupal

Copy link
Copy Markdown

Fixes #483.

M_1_SQRTPI is 1 / sqrt(pi), but all 16 real SH basis functions use it in their denominator. This scales each basis value by pi instead of using the documented orthonormal basis. For example, Y00 is about 0.8862269 rather than 0.2820948.

Replace the denominators with M_SQRTPI. Add a Falcor GPU regression test for Y00 and the degree-0 through degree-3 addition theorem on the three coordinate axes and normalized (1, 2, 3).

Validation:

  • Compiled the new test shader and the real imported Falcor module with official Slang v2026.19, both to SPIR-V and to CPU C++.
  • Executed that generated CPU C++ with the test's four directions. All 20 normalization checks fail against the original module and pass with this change.
  • Applied the repository's clang-format configuration and checked the diff for whitespace errors.

Limits: the GPU test was added and its Slang shader compiled, but it was not executed on a GPU. The Falcor C++ test runner and full Falcor suite were not built or run in this environment. The executable red/green evidence above is official-Slang CPU execution, not a GPU test pass.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

There might be an error in SphericalHarmonics.slang

1 participant