Jump to content
  • Advertisement
Sign in to follow this  
tenpoundbear

Sphere Map Texturing

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

If you intended to correct an error in the post then please contact us.

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 :)

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!