Hi Judith,<br><br>Does your obj file contains texture coordinates?<br>They are a basic requirement if you want to apply a texture on an object, if you do not provide them, it is impossible for a graphic renderer to know how to apply the texture on the object.<br>
You may have to use a modelling tool to create those coordinates or if your object is simple you can try to compute them by yourself (manually or by using some VTK filters like vtkTextureMapToSphere).<br><br>Regards,<br><br>
<div class="gmail_quote">2012/11/26 Judith Tony <span dir="ltr"><<a href="mailto:contactjudith@yahoo.co.in" target="_blank">contactjudith@yahoo.co.in</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div><div style="font-size:10pt;font-family:arial,helvetica,sans-serif"><div>Dear all,</div><div><br>I've tried to texture map an .obj file using the PNG file.<br>But I could not see the texture after rendering.Here is my code:</div>
<div>*************************************************<br>from vtk import *<br>object = vtkOBJReader()<br>object.SetFileName('aa.obj')<br>objectMapper = vtkPolyDataMapper()<br>objectMapper.SetInputConnection(object.GetOutputPort())<br>
objectActor=vtkActor()<br>objectActor.SetMapper(objectMapper)</div><div># Read the image data from a file<br>pngreader = vtkPNGReader()<br>pngreader.SetFileName('aa.png')<br>pngreader.Update()<br> </div><div># Create texture object<br>
texture = vtkTexture()<br>texture.SetInputConnection(pngreader.GetOutputPort())<br>texture.InterpolateOn()<br>objectActor.SetTexture(texture)</div><div>ren =
vtkRenderer()<br>ren.AddActor(objectActor)</div><div>.<br>.<br>.<br>***********************************</div><div>How can I view the texture on the top of the .obj file.Pls throw light on this</div><div>Thank you<br></div>
</div></div><br>_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br><b>Joachim Pouderoux</b><br><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><font size="1"><i>PhD, R&D Enginee</i>r</font> <br>
<b><font size="1"><a href="http://www.kitware.fr" target="_blank">Kitware SAS</a></font></b><br></blockquote>
<br>