Markus wrote:I tried this approach:
sphere[i].m_x = point.m_x / (sqrt(point.m_x*point.m_x + point.m_y*point.m_y + point.m_z*point.m_z));
sphere[i].m_y = point.m_y / (sqrt(point.m_x*point.m_x + point.m_y*point.m_y + point.m_z*point.m_z));
instead of
sphere[i].m_x = (dgFloat64 (1.0f) - point.m_x) * dgFloat64 (0.5f);
sphere[i].m_y = (dgFloat64 (1.0f) - point.m_y) * dgFloat64 (0.5f);
with similar results....
That is the same I am using, if you look at the code you will see that point is a nomalize value.
That form of mapping is no really a spherical mapping, it is more of less and flat projection.
the method I was using before is the correct Spherical mapping but it looks wrong and I think I know why.
The raeson it looks differenet is because it is OpenGl that is wrong.
OpenGl is not really applying a Spherical Mapping, they are applying a cylindrical mapping.
to test my theory try applying a cylindrical mapping to the Sphere, and I beleive it will looks just like the OpenGl Mapping.
if that works the I will make teh change.
Fist I was confused, but now I see what happen.
The first image you show in the first post is a correct Sphercial Mapping
The OpenGl shere is not a Spherical Mapping, it is a Cylindrical mapping.
That is look better has nothing to do with correctness. But the fact that is looks better is a good reason to apply Cylidrical mapping to a spherial objects instead of spherical mapping.
Bascially openGl apply cylidrical mapping without capping,
I will make that change and if it looks just like openGL.