Skip to main content
gamedev.net
🔒 Locked

Sphere Map Texturing

Started by tenpoundbear Jul 1, 2010 at 11:58 PM 0 replies 1k views
Original Post
tenpoundbear
tenpoundbear
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 :)

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.