5 replies to this topic

Posted 02 October 2012 - 07:55 AM

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

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

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.**

Posted 02 October 2012 - 01:15 PM

;)

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!

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!

Posted 02 October 2012 - 03:24 PM

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.

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

Posted 03 October 2012 - 02:12 AM

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!

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, 03 October 2012 - 02:13 AM.**