# SH Projection

This topic is 1937 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hi,
im using the old DirectX11 functions of the Texture2D class to project a cube map to spherical harmonics.
currently i'm testing if my results are correct. I would expect that to projection of completely white cube map results in the in coefficients that are all zero except of the first one (the ambient one) that should be Pi (because of the integral over the lambertian brdf).
But what i get is 3.5449 instead of PI .. the rest is close to zero what is fine.
Do you have any idea why this is the case? In this simplest of all tests the error is around 12%.

i created my cubemap with Format.R16B16B16A16_FLOAT, i also tried 32bit float or simple rgba8 (also sRGB but white should be the same)

Thanks!

Kai

##### Share on other sites

Do you have any idea why this is the case? In this simplest of all tests the error is around 12%.

Removing my post becase I just realized you are using a D3D function, not rolling your own. Nevermind me ;) Edited by chris77

##### Share on other sites
;)

thats something i'll do later to speed things up (and because its deprecated and not usable on winRT).. but for now the old methods should do it!

##### Share on other sites
Can you post a short program that does this computation? I don't know anything about DirectX, but someone else might see what you are doing wrong.

##### Share on other sites
Oh, actually, I figured it out. The first spherical harmonic is (1/2)*sqrt(1/pi), so when you integrate that on the whole sphere, you'll get that times 4*pi (the solid angle of the whole sphere in steradians). So the number you should get is
(1/2)*sqrt(1/pi)*4*pi = 2*sqrt(pi) = 3.54490770181103205458

##### Share on other sites
nice.. starting from this side is quite easy ;)
i was wrong to think that when i use rho/pi to normalize the brdf in the shader i had to get 1 (for rho = 1)

thanks! Edited by derKai

• 10
• 9
• 12
• 10
• 12