[Radiance-general] Re: Cubical sky maps?

Greg Ward gregoryjward at gmail.com
Sun Jun 13 09:13:34 PDT 2010


Using a cube map and actually mapping a cube are separable issues.   
You don't need local geometry to do this in other words.  The mapping,  
which you can translate pretty easily to a .cal file, is given in Paul  
Debevec's image-based lighting chapter in the HDR Imaging book,  
Section 9.4.4.  Quoting:

World to Image:
if Dz<0 and Dz<Dx and Dz<Dy
u = 1.5 - 0.5 * Dx / Dz
v = 2.5 - 0.5 * Dy / Dz
else if Dz>0 and Dz>Dx and Dz>Dy
u = 1.5 + 0.5 * Dx / Dz
v = 0.5 + 0.5 * Dy / Dz
else if Dy<0 and Dy<Dx and Dy<Dz
u = 1.5 + 0.5 * Dx / Dy
v = 1.5 - 0.5 * Dz / Dy
else if Dy>0 and Dy>Dx and Dy>Dz
u = 1.5 + 0.5 * Dx / Dy
v = 3.5 + 0.5 * Dz / Dy
else if Dx<0 and Dx<Dy and Dx<Dz
u = 0.5 - 0.5 * Dz / Dx
v = 2.5 + 0.5 * Dy / Dx
else if Dx>0 and Dx>Dy and Dx>Dz
u = 2.5 + 0.5 * Dz / Dx
v = 2.5 + 0.5 * Dy / Dx

Image to World:
if u>=1 and u <=2 and v>=0 and v<=1 // up
Vx = (u - 0.5) * 6
Vy = 1.0
Vz = (v - 0.125) * -8
else if u>=0 and u <=1 and v>=1 and v<=2 // left
Vx = -1.0;
Vy = (v - 0.375) * -8;
Vz = (u – 1/6) * -6;
else if u>=1 and u <=2 and v>=1 and v<=2 // forward
Vx = (u - 0.5) * 6;
Vy = (v - 0.375) * -8;
Vz = -1.0;
else if u>=2 and u <=3 and v>=1 and v<=2 // right
Vx = 1.0;
Vy = (v - 0.375) * -8;
Vz = (u – 5/6) * 6;
else if u>=1 and u <=2 and v>=2 and v<=4 // down
Vx = (u - 0.5) * 6;
Vy = -1.0;
Vz = (v - 0.625) * 8;
else if u>=1 and u <=2 and v>=3 and v<=4 // backward
Vx = (u - 0.5) * 6;
Vy = (v - 0.875) * 8;
Vz = 1.0;
normalize = 1 / sqrt(Vx * Vx + Vy * Vy + Vz * Vz)
Dx = normalize* Vx
Dy = normalize* Vy
Dz = normalize* Vz

Best,
-Greg

> From: R Fritz <RFritz at lbl.gov>
> Date: June 13, 2010 7:56:16 AM PDT
>
> On 2010-06-12 02:41:27 -0700, Lars O. Grobe said:
>
>> On 11.06.2010 18:57, R Fritz wrote:
>>> Anyone using these? Anyone think these might be possible?
>> Should be possible, but why give up the advantages of the  
>> dimensionless source-object? With cubical maps you must think about  
>> where in you cube the scene is to be located, how much related  
>> error to accept, then, how to get the increased scene bounding box  
>> reflected in the ambient setting...
>
> Thanks, Lars. The big reason for doing this is to make it possible  
> to use a captured sky, and it's probably easier to keep the exterior  
> housing containing cameras clean if it's got flat surfaces, than if  
> it's a sphere.



More information about the Radiance-general mailing list