# Sphere Map Texturing

This topic is 3089 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hey guys,

So I have my sphere working... it is kool!

And the best thing is that I completely understand the maths behind it too, even manipulated it so that it starts drawing on the negative z-axis.

Here is an image to see what it looks like.

Better resolution, more slices/segments.

My next step is is to texture it with a picture (i.e. earth). Been reading lots of stuff on it and it seems for my application the most appropriate implementation would something along Paul Rademacher's site, "Ray Tracing: Graphics for the Masses" or ZMan's article which is based on Paul's implementation anyways, "Ask the ZMan: Applying Textures, Part 3".

There is also Paul Bourke's article, "Parametric Equation of a Sphere and Texture Mapping" but I'm a bit confused as to which section of his article is appropriate for my problem.

It seems that Paul Rademacher's or ZMan's article would be what I need?

The way I am generating my sphere is manually, by converting spherical coordinates to cartesian coordinates.

SNIPPET OF CODE (generating north pole vertices here)vertices[ n ].position.x = radius * sinf( D3DXToRadian( phi + deltaPhi )) * sinf( D3DXToRadian( theta ));vertices[ n ].position.y = radius * cosf( D3DXToRadian( phi + deltaPhi ));vertices[ n ].position.z = ( -1 * radius ) * sinf( D3DXToRadian( phi + deltaPhi )) * cosf( D3DXToRadian( theta ));n++;vertices[ n ].position.x = radius * sinf( D3DXToRadian( phi )) * sinf( D3DXToRadian( theta ));vertices[ n ].position.y = radius * cosf( D3DXToRadian( phi ));vertices[ n ].position.z = ( -1 * radius ) * sinf( D3DXToRadian( phi )) * cosf( D3DXToRadian( theta ));n++;vertices[ n ].position.x = radius * sinf( D3DXToRadian( phi + deltaPhi )) * sinf( D3DXToRadian( theta + deltaTheta ));vertices[ n ].position.y = radius * cosf( D3DXToRadian( phi + deltaPhi ));vertices[ n ].position.z = ( -1 * radius ) * sinf( D3DXToRadian( phi + deltaPhi )) * cosf( D3DXToRadian( theta + deltaTheta ));

So what which one should be I try to understand, and hopefully be able to implement?

P. S. I want to give credit to johnstanp for helping me with understand what I know now :)

1. 1
2. 2
3. 3
Rutin
15
4. 4
5. 5

• 13
• 26
• 10
• 11
• 9
• ### Forum Statistics

• Total Topics
633727
• Total Posts
3013574
×