SSRSGJYD / NeuralTexture

Unofficial implementation of the paper "Deferred Neural Rendering: Image Synthesis using Neural Textures" in Pytorch.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Spherical harmonics coefficients

oKatanaaa opened this issue · comments

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!

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.