<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <title></title>
</head>
<body>
<big>Yep, so basically I was already as close as I could get. ;-) Well, thanx
anyway :-)<br>
<br>
BTW, the code I posted was just a quick stub program, not the actual one
I'm working on. In the real one, I already handle singularities at the poles
:-)</big><br>
<br>
Sean McInerney wrote:<br>
<blockquote type="cite" cite="mid4124F613.5050607@nmr.mgh.harvard.edu">Uhh
... yeah ... that was my point ... but perhaps I was too detailed. <br>
 <br>
If you want to texture map to a sphere without artifact, you cannot  merge
... period. BTW, you will still need to do the suggested  offsetting to avoid
a singularity at the north pole ... and the  subsequent cataclysmic explosion
;-) <br>
 <br>
I have attached your code minus merges and plus offsetting fixes. <br>
 <br>
Rock on. <br>
 <br>
-Sean <br>
 <br>
Jared Cohen wrote: <br>
  <blockquote type="cite">Well, I tried using the offset, and the back-and-forth
transform series.  But once it passed through the CleanPolyData filter, it
STILL gave me  the band-o'-crap down the side. I'm starting to reach the
same  conclusion that I had reached the last time I tried this -- namely,
that  merging the points just isn't worth the headache. ;-) <br>
 <br>
Sean McInerney wrote: <br>
 <br>
    <blockquote type="cite">Jared, <br>
 <br>
&nbsp; You'll notice that the band of crap on your sphere is actually your  entire
texture mirror mapped onto that single strip of polygons ...  not just from
the center as I said previously ... unless that strip is  1 pixel wide ;-) 
      <br>
 <br>
-Sean <br>
 <br>
Sean McInerney wrote: <br>
 <br>
      <blockquote type="cite">Hi Jared, <br>
 <br>
&nbsp; Actually, I think that I do understand your problem. If you merge  the
non-polar points along the edges of the plane mapped to the  sphere, what&nbsp;
are the texture coordinates of those points? Get it?  Before the merge, they're
zero (0) on one side, one (1) on the other.  After the merge, you are getting
an interpolation between 0 and 1 /  thetaRes - 1 (i.e. some crap from the
center of your image being  placed along that border). Furthermore, by using
the offsetting that  I suggest, as well as going back and forth with the
transform, you'll  avoid having a black hole at the north pole (you'll see
what I mean).  The bottom line is that, for you, the only points worth merging
are  probably the poles. Even then, you'll end up with texture artifact  that
won't show up with merging. <br>
 <br>
&nbsp; So, this doesn't solve the *grand* merging debate, but it may solve  yours
;-) <br>
 <br>
-Sean <br>
 <br>
Jared Cohen wrote: <br>
 <br>
        <blockquote type="cite">Thanks, but I don't think you understand
the problem. I can close  the gap just fine, but the two edges will overlap
without being  merged together. It's when I merge them using a CleanPolyData
filter  that I get the warping effect. <br>
 <br>
 <br>
 <br>
          <blockquote type="cite">Hi Jared, <br>
 <br>
&nbsp; I have some C++ code based on the spherical Tcl example that I  think solves
your problem. It avoids a singularity at the Z axis by  offsetting the plane
by a very small amount. I am attaching the  source file 'spherical.cxx'.
It takes any valid 2D vtkImageReader2  input and maps it to a sphere in the
manner that you describe. <br>
 <br>
The Cmake configuration stuff is as follows: <br>
 <br>
ADD_EXECUTABLE (spherical spherical.cxx) <br>
TARGET_LINK_LIBRARIES (spherical vtkRendering vtkIO vtkGraphics) <br>
 <br>
-Sean <br>
 <br>
          </blockquote>
        </blockquote>
_______________________________________________ <br>
This is the private VTK discussion list. Please keep messages  on-topic.
Check the FAQ at: <a class="moz-txt-link-rfc2396E" href="http://public.kitware.com/cgi-bin/vtkfaq">&lt;http://public.kitware.com/cgi-bin/vtkfaq&gt;</a> <br>
Follow this link to subscribe/unsubscribe: <br>
<a class="moz-txt-link-freetext" href="http://www.vtk.org/mailman/listinfo/vtkusers">http://www.vtk.org/mailman/listinfo/vtkusers</a> <br>
 <br>
      </blockquote>
    </blockquote>
 <br>
  </blockquote>
  <pre wrap="">
<hr width="90%" size="4">
import sys
from vtk import *

deg2rad = 3.14159265359 / 180.0
radius = 1.0
th_min, th_max = 0.0, 360.0 * deg2rad
ph_min, ph_max = 0.0, 180.0 * deg2rad

#create the plane
plane = vtkPlaneSource()
plane.SetOrigin(radius, ph_max - 0.000001, th_min)
plane.SetPoint1(radius, ph_max - 0.000001, th_max)
plane.SetPoint2(radius, ph_min + 0.000001, th_min)
plane.SetXResolution(36)
plane.SetYResolution(18)
plane.Update()

#warp it into a sphere
transform = vtkSphericalTransform()
transform.Update()

tpoly = vtkTransformPolyDataFilter()
tpoly.SetInput(plane.GetOutput())
tpoly.SetTransform(transform)
tpoly.Update()

#setup standard VTK pipeline
mapper = vtkPolyDataMapper()
mapper.SetInput(tpoly.GetOutput())
mapper.ImmediateModeRenderingOn()
mapper.Update()

actor = vtkActor()
actor.SetMapper(mapper)
actor.PickableOn()
actor.GetProperty().BackfaceCullingOn()

reader = vtkPNMReader()
reader.SetFileName("../../wrap/earth.ppm")

texture = vtkTexture()
texture.SetInput(reader.GetOutput())
texture.InterpolateOn()

actor.SetTexture(texture)

ren = vtkRenderer()
ren.AddActor(actor)

win = vtkRenderWindow()
win.AddRenderer(ren)
win.SetSize(500, 500)

iren = vtkRenderWindowInteractor()
iren.SetRenderWindow(win)

style = vtkInteractorStyleTrackballCamera()
iren.SetInteractorStyle(style)

iren.Initialize()
win.Render()
iren.Start()
  </pre>
</blockquote>
<br>
</body>
</html>