The cube version before it has been warped
Here it is after the clever warping using a simple function which was so gregariously given to me by the lovely Jasmine over at GPwiki forums.
1: Public Function CubeToSphereMapping(ByVal inputvector As Vector3) As Vector3
2: Dim L As Single
3: Dim x, y, z As Single
4: With inputvector
5: x = .X - 0.5
6: y = .Y - 0.5
7: z = .Z - 0.5
8: End With
9: Dim res As Vector3
10: L = Radius / (x * x + y * y + z * z) ^ 0.5
11: res.X = x * L
12: res.Y = y * L
13: res.Z = z * L
14: Return res
15: End Function
Then we get
Early screenshot with some texturing and all 6 sides mapped to the cube.
Here is a wireframe version of the same
No comments:
Post a Comment