SSRSGJYD / NeuralTexture

Unofficial implementation of the paper "Deferred Neural Rendering: Image Synthesis using Neural Textures" in Pytorch.
265 stars 36 forks source link

Spherical harmonics coefficients #2

Closed oKatanaaa closed 4 years ago

oKatanaaa commented 4 years ago

Thank you for your repository! In the utils.py file you provide the following code for the Spherical harmonics coefficients: sh[0] = 1 / np.sqrt(4 * np.pi) sh[1:4] = 2 * np.pi / 3 * np.sqrt(3 / (4 * np.pi)) sh[4] = np.pi / 8 * np.sqrt(5 / (4 * np.pi)) sh[5:8] = 3 * np.pi / 4 * np.sqrt(5 / (12 * np.pi)) sh[8] = 3 * np.pi / 8 * np.sqrt(5 / (12 * np.pi))

It seems that you use the first 9 harmonics as it is done in the paper. I found the following formulas and they are identical to yours except the coefficients: image Picture taken from http://www.cse.chalmers.se/~uffe/xjobb/Readings/GlobalIllumination/Spherical%20Harmonic%20Lighting%20-%20the%20gritty%20details.pdf I tried to play with the math a bit but didn't get any insight anyway. Is there some reasoning behind your coefficients? Thank you!

SSRSGJYD commented 4 years ago

Thank you for your carefulness. I have worked something wrong about Spherical harmonic coefficients. I have corrected the implementation. Data generation projects are to be corrected.