[vtkusers] vtkTextureMapToSphere - PreventSeamOn also prevents correct scale

John Davis gcubed.developer at yahoo.com
Fri Aug 17 20:45:46 EDT 2007


I have a complete working VTK 5.0.3/C++ application that includes these lines:

    vtkTextureMapToSphere *textureMapper = vtkTextureMapToSphere::New();
    textureMapper->SetInput(globeOverlay->GetOutput());
    textureMapper->PreventSeamOff(); 

The application displays a rotating 3D globe with earth geography mapped from an 2D image to a 2D texture.  The 2D image is rectangular and linear in X and Y with the prime meridian in the center, 180 longitude on the right edge, and, -180 longitude on the left edge.  From vtkTransformTextureCoords I use

 ->AddPosition(0.5,0.0,0.0) 
 ->FlipROn()

My application does exactly what it is supposed to do except that the prime meridian is a jumbled narrow band of colors and there is a visible seam in the Pacific at 180.

If I change only this line:

    textureMapper->PreventSeamOn(); 

the prime meridan closes, but the entire geography is compressed and duplicated in both the eastern and western hemispheres.

No amount of experimenting with vtkTransformTextureCoords scaling, positioning, and flipping has restored the correct geography.

I'm beginning to believe that this code from vtkTextureMapToSphere.cxx is causing the problem, but it looks logical.  What am I missing?

    if ( this->PreventSeam )
      {
      tc[0] = thetaX / vtkMath::Pi();
      }
    else
      {
      tc[0] = thetaX / (2.0*vtkMath::Pi());
      if ( thetaY < 0.0 )
        {
        tc[0] = 1.0 - tc[0];
        }
      }

 



       
---------------------------------
Moody friends. Drama queens. Your life? Nope! - their life, your story.
 Play Sims Stories at Yahoo! Games. 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20070817/8e915f7e/attachment.htm>


More information about the vtkusers mailing list