Jump to content
  • Advertisement
Sign in to follow this  

HDR Angular Maps

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

I've been playing with hdr images alot lately and have found that most "light probe" images are in the mirror ball format, aka "angular map". I've been searching around trying to get information on the math so that i could decode them into a cube map but all i could find was this: rendering with natural light which contains: { angmap.cal Convert from directions in the world to coordinates on the angular sphere image -z is forward (outer edge of sphere) +z is backward (center of sphere) +y is up (toward top of sphere) } sb_u = 0.5 + DDx * r; sb_v = 0.5 + DDy * r; r = 0.159154943*acos(DDz)/sqrt(DDx*DDx + DDy*DDy); DDy = Py*norm; DDx = Px*norm; DDz = Pz*norm; norm = 1/sqrt(Py*Py + Px*Px + Pz*Pz); Any explanation of this would be appreciated.

Share this post


Link to post
Share on other sites
Advertisement
Hi,

If you just need to convert the angular map to a cubemap you can use HDRShop (version 1 is free) to convert to it to a vertical cross style cubemap. CubeMapGen from ATI can load this format and convert it to DDS or separate images for each face.

The calculations you posted should be read bottom up. (Px,Py,Pz) is a direction in the world and (DDx,DDy,DDz) is the normalized world direction. (sb_u, sb_v) is resulting angular texture coodinates.

acos(DDz) maps DDz from [-1..1] to [-Pi..Pi] which is then divided by 2*Pi ( 0.159154943) which scales it to [-1/2..1/2]. r (the radius, or scale factor) is then divided by the lenght of the 2D vector (DDx,DDy) to compensate for it not being a unit vector. (DDx*r) and (DDy*r) will now both be in the interval [-1/2..1/2] so (sb_u,_sb_v) is the angular texture coordinates ranging from [0..1].

The angular map is also the type of environment map that OpenGL expects when you want to use sphere mapping (glTexGen = GL_SPHERE_MAP).

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!