I have, so far, been able to create the vertices and UV coords etc for a sphere that would be textured with a cube map. I have also successfully loaded a cube texture from file and applied it to my sphere and it looks awesome.
So now, I want to randomly create a noise cube texture map to apply to my sphere.
I have a class which can create 1d, 2d, 3d and 4d noise. My problem is I don't know the math needed to sample a sphere map out of the cube, and then how to translate this to the 6 textures that make up with my cubemap.
I guess first I need to know how to first sample the points of a sphere in 3d; and then how to translate these to x,y,z coordinates for the 6 sides. I can probably work it out from there.
I would have thought this would be simple enough to Google, but I'm not finding what I need.
For whomever comes along next, here's the answer. @Jason has the right idea below. Here's how I solved it:
- March through each of the faces of the cube and each UV coord for that face
- Normalize each position vector
- Multiply by the radius of your sphere. You now have the coordinates of the sphere edge
- These coordinates can be used to sample from your 3D noise function
You'll end up with each faces UV coordinates being filled with the noise that is at the spherical equivalents position in the noise.
(I hope that was in english). I will try to remember to update this later with full code once I've cleaned it up.