views:

894

answers:

6

I've seen well-textured balls, planets, and other spherical objects in couple of games, last time in UFO: aftermath. If you just splatter a texture into latitude/longditude as u and w -coordinates you'll get lots of ugly texture distortion to poles.

I can think myself an one way to implement a spherical map with minimum distortion. By mapping in triangles instead of squares. But I don't know any algorithms. How to produce vertices and texture coordinates for such spheres?

Also, I don't see a way to generate a complete spherical map from a simple flat square map. Is there some intuitive way on drawing such maps without real trouble?

Though, is there other algorithms to render a sphere without or with minimal distortion?

Both raytracing and rasterising algorithms are interesting.

+2  A: 

You can use a rectangular map with longitudinal blurring that increases near the poles (from none at the equator to say 60 degrees north). In conjunction with mip-maps this should eradicate some of the effects you are mentioning.

JeeBee
+2  A: 

Drew Olbrich came up with a nifty way of tesselating a sphere to produce a nonahedron. If you increase the number of vertices, you'll get a fairly decent spherical tesselation.

plinth
+2  A: 

Or you can use a cubemap. That's generally the preferred way to do environment mapping, which is basically what you are describing.

MSN

MSN
A: 

Do not split sphere by longitude and latitude. Instead use what is called the GeoSphere in 3Ds Max. (Actually, a polyhedron, the geodesic sphere.)

Alexander Gladysh
+5  A: 

The hairy ball theorem states that it is impossible to define continuous texture coordinates on a sphere without any poles that distort the texture.

palm3D
+2  A: 

Lat/lon "spheres" distort by definition. If you're into programming, start with a tetrahedron and subdivide as much as necessary, by subdividing each triangle into 4 triangles and repositioning midpoints at the given radius from center.

If you're into modeling, the GeoSphere (as previously mentioned) or any similar will solve your problem.

The point is that the triangles will have a constant amount of distortion which is independent of the latitude.

Also note that a (closed) surface subdivision will enable you to have a (C)LOD rather easily.

Texturing is another story, but once you have a good sphere you have less problems.

Hope this sparks your imagination :)

ptor