Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

Right now I'm texturing the octahedron with the formular from wikipedia(Finding UV on a sphere): UV Coordinates Wikipedia

That unfortunately leads to heavy distortion right at the beginning, which of course leads to a lot of distortion when splitting up the triangles when approximating it to a sphere: here is a picture

The upper and lower triangles are okay, the left and right ones are distorted. Now I'm looking for different formulars to calculate the uv's. Are there any other easy formulars? Or would another approach be much more complicated?

share|improve this question
add comment

1 Answer

up vote 0 down vote accepted

The Wikipedia entry you cite is correct - your image shows the characteristic pattern (the stripes) that indicates one of your calculations that is supposed to vary isn't, it's remaining constant - (the human mapping analog to this is the notion many people have that Greenland is the size of a continent, but that's another issue :-) )

Without seeing your code it's difficult to guess the exact error, but my guess is that you may not have paid attention to the fact that d hat is a unit vector. Try this and see if it helps

1) compute the center of your approximation of a sphere 2) For each point that is a vertex of your approximation, compute |TheCenter - YourVertex|, i.e. subtract the vertex from the center and normalize the result - this gives you the unit vector you need 3) Use the unit vector x,y, and z coordinates in the equation you got from Wikipedia

Also note the comment about the sphere's poles being on the y axis - if this isn't what you want you will still get a uniform texture mapping, it just may not be oriented the way you want it to be

You should work at making sure you understand this before you move on to more complex UV generation - this is one of the simplest uv problems, and more complex ones can really be furballs :-)

share|improve this answer
    
You are right, the uv's are correct. The Problem was in the fragment shader for the height based textures. The shader was made for normal terrain and not for spherical terrain. –  Wipster May 16 '13 at 6:12
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.