Rect
Description
A rectangle on a cubemap face.
The following figure shows the relation between cubemap coordinates and cubemap face coordinates:
Y- Z+ E-------F [0,0,n] [n,0,n] | / /. /| E ------------ F |/ / . / | | | X- --+-- X+ A-------B | | o--------> | /| | G....|..H | | +fx | / | | . | / | | Y- | Z- Y+ |. |/ | | | C-------D | V +fy | [0,0,0] [n,0,0] [n,0,n] [0,0,n] [0,0,0] A ------------ B ------------ F ------------ E ------------ A | | | | | | o--------> | o--------> | o--------> | o--------> | | | +fx | | +fx | | +fx | | +fx | | | Z- | | X+ | | Z+ | | X- | | | | | | | | | | | V +fy | V +fy | V +fy | V +fy | | | | | | C ------------ D ------------ H ------------ G ------------ C [0,n,0] [n,n,0] [n,n,n] [0,n,n] [0,n,0] | o--------> | | | +fx | | | Y+ | n := Maximum cubemap coordinate | | | [x,y,z] := Cubemap coordinates | V +fy | fx := Positive cubemap face X-axis | | fy := Positive cubemap face Y-axis G ------------ H [0,n,n] [n,n,n]
The cross-product between the cubemap face X-axis and Y-axis point towards the interior of the cubemap cube. This figure shows the possible cubemap wrapping cases (along edges and corners):
+--------------------+--------------------+--------------------+--------------------+ | [E] -fy Y- | [F] +fx X+ | [A] -fy X- | [B] -fy X+ | | \ \ | \ \ | \ \ | \ \ | | -fx \ o-- +fx | -fy \ o-- +fy | -fy \ o-- -fx | -fy \ o-- +fx | | \ \ | \ \ | \ \ | \ \ | | X- o [A]----[B] | Y- o [B]----[D] | Z- o [C]----[G] | Z- o [D]----[H] | | / / | / / | / / | / / | | +fy / o-- +fx | -fx / o-- +fy | +fx / o-- +fy | -fx / o-- +fy | | / / | / / | / / | / / | | [C] +fy Z- | [A] -fx Z- | [D] +fx Y+ | [C] -fx Y+ | +--------------------+--------------------+--------------------+--------------------+ | [G] +fy Z+ | [E] +fx Z+ | [E] -fy Z+ | [F] -fy X+ | | \ \ | \ \ | \ \ | \ \ | | +fy \ o-- -fx | -fx \ o-- +fy | -fy \ o-- -fx | -fy \ o-- -fx | | \ \ | \ \ | \ \ | \ \ | | X- o [E]----[F] | Y- o [F]----[H] | X- o [G]----[H] | Z+ o [H]----[D] | | / / | / / | / / | / / | | +fx / o-- +fx | +fy / o-- +fy | +fx / o-- +fx | +fx / o-- -fy | | / / | / / | / / | / / | | [A] +fy Y- | [B] -fx X+ | [C] -fy Y+ | [G] -fx Y+ | +--------------------+--------------------+--------------------+--------------------+