Tolga,<br><br>I believe VTK only supports a single texture per object. If you want to apply multiple textures you have a few choices. A simple way if your textures don't overlap, is to just make multiple copies of the object and texture each with a different texture. By placing a transparent border around your texture and setting the texturing parameters correctly, you can get a reasonable appearance. If this doesn't meet your needs, you have 2 other approaches. The first is to find a way to divide your object up into multiple objects each with its own texture, or you need to find a way to create a single texture map from your multiple individual images. For the former, look at:
<br><b><span style="font-size: 10pt; font-family: "Times New Roman TUR";"><br></span></b><span style="font-size: 10pt; font-family: "Times New Roman TUR";">W. Turner, T. Drake,
M. Osterkamp, D. Kaiser, J. Miller, P. Tu, C. Wilson, <i>Using computer vision
to map LASER ultrasound onto CAD geometries, </i>Review of Quantitative
Nondestructive Evaluation, 22, American Institute of Physics (2003)</span>
<br><br>and for the latter look at:<br><br><span><font size="-1">ROCCHINI, C., CIGNONI, P., AND MONTANI,
C. Multiple textures stitching and blending on 3d objects. In
Eurographics Rendering Workshop 1999 (June 1999), Eurographics.
<a href="http://citeseer.ist.psu.edu/rocchini99multiple.html" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://citeseer.ist.psu.edu/rocchini99multiple.html</a></font><br></span><br><br><div><span class="gmail_quote">
On 1/9/08, <b class="gmail_sendername">Tolga Birdal
</b> <<a href="mailto:tbirdal@gmail.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">tbirdal@gmail.com</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hello,<br>
<br>I am currently trying to form a 3D object from OBJ files. What I would<br>like to do is to map multiple textures on the object. I know that the<br>texture coordinates are in vtkPolyDataMapper but I couldn't make use of
<br>it. vtkImageAppend simply didn't work well. There are different textures<br>for different places on the object.<br>Is this supported in VTK?<br><br>So far, I could only load a single texture using vtkTexture. Here is the
<br>code (The code is written in C# but exactly same with C++):<br><br> vtkOBJReader vo = new vtkOBJReader();<br> vo.SetFileName(@"C:\Objs\idle.obj");<br> vo.Update();<br><br> vtkPolyDataMapper stlMapper= new vtkPolyDataMapper();
<br> stlMapper.SetInput(vo.GetOutput());<br><br> stlActor.SetMapper(stlMapper);<br><br> vtkJPEGReader bmp1 = ReadTexture(@"C:\Objs\idle_hi.jpg");<br><br> //other textures to load
<br> //vtkJPEGReader bmp2 = ReadTexture(@"C:\Objs\idle_L_hi.jpg");<br> //vtkJPEGReader bmp3 = ReadTexture(@"C:\Objs\idle_R_hi.jpg");<br><br> vtkTexture vt = new vtkTexture();
<br> vt.InterpolateOn();<br><br> vt.AddInputConnection(bmp1.GetOutputPort());<br><br> stlActor.SetTexture(vt);<br><br> vtkRenderer ren1 = new vtkRenderer();<br> ren1.AddActor
(stlActor);<br> vtkFormsWindowControl1.GetRenderWindow().AddRenderer(ren1);<br> vtkFormsWindowControl1.GetRenderWindow().Render();<br><br><br>And here is the ReadTexture method:<br><br>private vtkJPEGReader ReadTexture(string fn)
<br> {<br> vtkJPEGReader v = new vtkJPEGReader();<br> v.SetFileName(fn);<br> v.Update();<br> return v;<br> }<br><br>Thanks for any help,<br>Tolga<br><br>_______________________________________________
<br>This is the private VTK discussion list.<br>Please keep messages on-topic. Check the FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://www.vtk.org/Wiki/VTK_FAQ
</a><br>Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://www.vtk.org/mailman/listinfo/vtkusers</a><br></blockquote></div><br><br clear="all"><br>
-- <br>Wesley D. Turner, Ph.D.<br>Kitware, Inc.<br>R&D Engineer<br>
28 Corporate Drive<br>Clifton Park, NY 12065-8662<br>Phone: 518-371-3971 x120