Sign in to follow this  

how do you create textures for spherical mapping

Recommended Posts

Ok, after experimenting with some different techniques with texture mapping to a box for our background in our 3D space game I've decided that maybe a sphere would be a better alternative. I've heard that a skysphere is generally better for games with the full 360 degree range of viewing. The problem is I can't find any tutorials or anything on how to create texture maps that will map to a sphere interior correctly. I've tried all sorts of methods both in photoshop and 3ds max for the box type mapping but I could never get it right (no matter what I did, there was still distortion in the game itself as well as dimming of the texture as it reached edges of the box). Does anyone know of any tutorials or can tell me any methods to taking the flat 2d images I have in photoshop and piecing them together and distorting them so they'll map to a sky sphere correctly? Thanks, Dotren

Share this post

Link to post
Share on other sites
You need to use a renderer that has a spherical or cylindrical camera, and render the texture using that projection. Then map the texture coordinates appropriately. Here's how I've done it:

1) Create sphere in your modeler.
2) Apply a Cylindrical mapping (no cap) to your sphere, around the up axis.
3) Design your background scene in your renderer (say, pov-ray).
4) Render the background scene, using a cylindrical projection. In this projection, the U axis is the rotation around the up axis (i e, heading), and the V axis is the elevation (with horizontal in the middle, and up at the top). I e, polar coordinates.
5) Use the texture on the sphere.

This wastes a bit of texture space, because of the stretching near the poles which uses lots of texels for a small area the player won't look at. But whatever.

However, I find that sky cubes generally work better, they have less smearing and better texel density, and they're not hard at all to get working right (for me). I render these in POV-ray, too :-)

Lately, however, I've been doing only sky (no distant mountains), and the most fun way is this:

1) create a sphere that's about 50 m radius
2) chop the sphere so that only 5 m of the top remains. You'll have a very flat dome
3) put the origin of the chopped object just above the flat "floor" of the dome
4) apply a planar texture coordinate mapping across the dome
5) use your favorite procedural cloud pixel shader to actually texture this sky, slowly scrolling the result across in one direction

This makes for very nice clouds, that can change (based on the procedural shader), and scroll quite realistically.

Share this post

Link to post
Share on other sites
Never used POV-ray, I'll have to check it out.

I recently found a tutorial on how to use a translucent cube with a reflect/refract material on it to render out the 6 images needed for a skybox. I found several problems though.

First and foremost, I'm still getting bad distortions actually in the game. This could be due to the size of the skybox (too big so parts of the texture are too far from the camera?) or maybe simply how we're doing the texture application to the box (will have to look into our code and see if we're doing something wrong).

The second problem isn't really huge but I found some AWESOME tutorials on how to make starfields, planets, and suns in Photoshop and I have a few finished products that I intended to use in the game. I've tried to create similar images in 3ds max but I've only succeeded with the starfield and, to a limited extent, the sun. I've yet to find a good tutorial on 3D planet creation, from early texture creation (I've found some Earth tutorials but I'm trying to figure out how to do these with new planet textures) to final rendering (with atmosphere glows and all).


Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this