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

**1**

5 replies to this topic

Sponsor:

###
#2
Members - Reputation: **266**

Posted 02 October 2012 - 11:58 AM

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, 02 October 2012 - 12:05 PM.**

###
#5
Crossbones+ - Reputation: **14889**

Posted 02 October 2012 - 03:29 PM

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

(1/2)*sqrt(1/pi)*4*pi = 2*sqrt(pi) = 3.54490770181103205458