GPUOpen-LibrariesAndSDKs / Capsaicin

AMD ARR team rendering framework
MIT License
363 stars 32 forks source link

Weird divisor when projecting octahedron probe texture to spherical harmonics. #21

Open Hineven opened 2 months ago

Hineven commented 2 months ago

https://github.com/GPUOpen-LibrariesAndSDKs/Capsaicin/blob/d642e5dbb35c443fe681936be7806dce1042b6cc/src/core/src/render_techniques/gi10/gi10.comp#L1462

The line of code above weights the number of hemispherical samples by 1/probe_size when computing SH coefficients for later shading, however the number of samples is probe_size*probe_size. The normalization seems incorrect however if i change the weight to 1/(probe_size*probe_size) the scene seems to be too dark compared to the ray-traced reference.

Hineven commented 2 months ago

Maybe an integral area multiplier (4 x PI) is also missing? And by conicidence 4 x PI (12+) and 1/probe_size (1/8) canceled out making the final shading result about 50% darker than the PT reference. Tone mapping further mitigated the difference.