Closed mattrdowney closed 6 years ago
Blind commit on e150915ebe75e86b410271be4bf1a335884738fe
After thinking about this, the right way to do NormalizedCartesianCoordinates -> NormalizedCubeCoordinates (and inverse) is to normalize the vector in the sphere direction and do a raycast against the plane coincident with the sign of the magnitude of the largest coordinate of the vector.
CubeUVCoordinates should be fine.
Done and verified as of 54ec8ca75fba5615d843b1fcbf79644c7c7cc49a
Originally I was just programming SkyboxCoordinates, but I realized I should use a similar process (and naming convention) to NormalizedOctahedralCoordinates and OctahedronUVCoordinates.
The goal here is to use a good mapping (e.g. http://mathproofs.blogspot.com/2005/07/mapping-cube-to-sphere.html).
Unity Skyboxes look like: -|-- (for the six faces), to be more specific:
U LFRB D
where LFRBUD represent up, left, front, right, back, down
So the CubeUVCoordinates should take that mapping into account.