Thank you Bill!<br>Is there any tools can convert 3DMax *.max or *.3ds file to *.vtk? We have a lot of 3ds file, but I want to use VTK to show it in a touch screen. It&#39;s very interesting program, but vtk3DSImporter cannot load texture, and lost some informations of this format.<br>


<br>Thanks,<br>Yun<br><br><div class="gmail_quote">2010/9/26 Bill Lorensen <span dir="ltr">&lt;<a href="mailto:bill.lorensen@gmail.com">bill.lorensen@gmail.com</a>&gt;</span><br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">

The 3DSImporter only reads geometry and colors. If does not read the<br>
texture(which I think is stored in an .mli file) nor the texture<br>
coordinates (which I think are called mapping coordinates).<br>
<div><div></div><div class="h5"><br>
On Sun, Sep 26, 2010 at 12:20 AM, quengzi &lt;<a href="mailto:quengzi@gmail.com">quengzi@gmail.com</a>&gt; wrote:<br>
&gt; I have read the source code of vtk3DSImpoter and vtkOBJReader, vtk3DSImpoter<br>
&gt; implement below functions which related the metadata:<br>
&gt; ImportProperties // just walk the list of material properties, creating vtk<br>
&gt; properties<br>
&gt; ImportLights<br>
&gt; ImportCameras<br>
&gt; ImportActors<br>
&gt; And there is a function named &quot;parse_mdata&quot;:<br>
&gt; if (chunk.end &lt;= mainchunk-&gt;end)<br>
&gt;       {<br>
&gt;       switch (chunk.tag)<br>
&gt;         {<br>
&gt;         case 0x2100: parse_colour (importer, &amp;global_amb);<br>
&gt;           break;<br>
&gt;         case 0x1200: parse_colour (importer, &amp;bgnd_colour);<br>
&gt;           break;<br>
&gt;         case 0x2200: parse_fog (importer, &amp;chunk);<br>
&gt;           break;<br>
&gt;         case 0x2210: parse_fog_bgnd(importer); //It&#39;s a empty function, not<br>
&gt; implement yet<br>
&gt;           break;<br>
&gt;         case 0xAFFF: parse_mat_entry (importer, &amp;chunk);<br>
&gt;           break;<br>
&gt;         case 0x4000: parse_named_object (importer, &amp;chunk);<br>
&gt;           break;<br>
&gt;         }<br>
&gt;       }<br>
&gt; the vtkOBJReader in the IO folder, but the vtk3DSImporter be put into Hybird<br>
&gt; folder.<br>
&gt;<br>
&gt;<br>
&gt; 2010/9/26 quengzi &lt;<a href="mailto:quengzi@gmail.com">quengzi@gmail.com</a>&gt;<br>
&gt;&gt;<br>
&gt;&gt; Thank you Eric very much!<br>
&gt;&gt; Your advise is very important for me, I have searched the old mailing<br>
&gt;&gt; list, but most of the problem about 3DSImpoter is no result. I think you are<br>
&gt;&gt; right, the designer need send me another file format.<br>
&gt;&gt;<br>
&gt;&gt; Yun<br>
&gt;&gt;<br>
&gt;&gt; 2010/9/26 Eric E. Monson &lt;<a href="mailto:emonson@cs.duke.edu">emonson@cs.duke.edu</a>&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; Hey Yun,<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; I&#39;ve never used the vtk3DSImporter (or dotnet), but I would guess that if<br>
&gt;&gt;&gt; the importer has problems with textures, then probably it&#39;s not just losing<br>
&gt;&gt;&gt; the textures, but it&#39;s also not importing the texture coordinates. So, when<br>
&gt;&gt;&gt; you try to apply a texture manually there is nothing to tell the system<br>
&gt;&gt;&gt; where to put the texture.<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; I have a feeling, looking back on old mailing list postings, that the<br>
&gt;&gt;&gt; 3DSImporter really just grabs the most basic geometry, and computes Normals,<br>
&gt;&gt;&gt; but it&#39;s not designed to pull in anything more than the polygons. I&#39;m sure<br>
&gt;&gt;&gt; this will disappoint you, but maybe there&#39;s a chance someone else has<br>
&gt;&gt;&gt; another solution for converting your file into another format...?<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; Good luck,<br>
&gt;&gt;&gt; -Eric<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; ------------------------------------------------------<br>
&gt;&gt;&gt; Eric E Monson<br>
&gt;&gt;&gt; Duke Visualization Technology Group<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; On Sep 25, 2010, at 11:22 AM, quengzi wrote:<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; &gt; Hi all,<br>
&gt;&gt;&gt; &gt;<br>
&gt;&gt;&gt; &gt; I&#39;m a newer of VTK, I use VTK Dotnet to open a 3ds file, someone tell<br>
&gt;&gt;&gt; &gt; me that vtk3DSImpoter do not support texture, so I want to draw it by<br>
&gt;&gt;&gt; &gt; manual, but it failed, I cannot see any different after add the texture by<br>
&gt;&gt;&gt; &gt; manual, below is my code:<br>
&gt;&gt;&gt; &gt;             string fileName = @&quot;E:\VTK\3D Module\Mickey\Mickey.3ds&quot;;<br>
&gt;&gt;&gt; &gt;             vtk3DSImporter importer = new vtk3DSImporter();<br>
&gt;&gt;&gt; &gt;             importer.ComputeNormalsOn();<br>
&gt;&gt;&gt; &gt;             importer.SetFileName(fileName);<br>
&gt;&gt;&gt; &gt;             importer.Read();<br>
&gt;&gt;&gt; &gt;             importer.GetRenderer().ResetCamera();<br>
&gt;&gt;&gt; &gt;             importer.DebugOn();<br>
&gt;&gt;&gt; &gt;<br>
&gt;&gt;&gt; &gt;             //Add or Remove this section, no differents<br>
&gt;&gt;&gt; &gt;             vtkPNGReader pngReader = new vtkPNGReader();<br>
&gt;&gt;&gt; &gt;             pngReader.SetDebug(1);<br>
&gt;&gt;&gt; &gt;             pngReader.SetFileName(@&quot;E:\VTK\3D Module\Mickey\l.png&quot;);<br>
&gt;&gt;&gt; &gt;             vtkTexture texture = new vtkTexture();<br>
&gt;&gt;&gt; &gt;             texture.SetInput(pngReader.GetOutput());<br>
&gt;&gt;&gt; &gt;             texture.InterpolateOn();<br>
&gt;&gt;&gt; &gt;             vtkActor actor = new vtkActor();<br>
&gt;&gt;&gt; &gt;             actor.SetTexture(texture);<br>
&gt;&gt;&gt; &gt;             importer.GetRenderer().AddActor(actor);<br>
&gt;&gt;&gt; &gt;<br>
&gt;&gt;&gt; &gt;             //Below is add a light, and it&#39;s okay<br>
&gt;&gt;&gt; &gt;             vtkLight light = new vtkLight();<br>
&gt;&gt;&gt; &gt;             light.SetColor(1,1 , 1);<br>
&gt;&gt;&gt; &gt;             light.SwitchOn();<br>
&gt;&gt;&gt; &gt;             light.SetIntensity(0.9);<br>
&gt;&gt;&gt; &gt;             light.SetAmbientColor(1, 1, 1);<br>
&gt;&gt;&gt; &gt;<br>
&gt;&gt;&gt; &gt; light.SetPosition(importer.GetRenderer().GetActiveCamera().GetPosition());<br>
&gt;&gt;&gt; &gt;<br>
&gt;&gt;&gt; &gt; light.SetFocalPoint(importer.GetRenderer().GetActiveCamera().GetFocalPoint());<br>
&gt;&gt;&gt; &gt;<br>
&gt;&gt;&gt; &gt;             importer.GetRenderer().SetBackground(0.1,0.2,0.4);<br>
&gt;&gt;&gt; &gt;             importer.GetRenderer().AddLight(light);<br>
&gt;&gt;&gt; &gt;<br>
&gt;&gt;&gt; &gt;             renderer[0] = importer.GetRenderer();<br>
&gt;&gt;&gt; &gt;             AddRendererToRenderWindow(renWin);<br>
&gt;&gt;&gt; &gt; ...<br>
&gt;&gt;&gt; &gt; Any suggestions will be appropriated.<br>
&gt;&gt;&gt; &gt;<br>
&gt;&gt;&gt; &gt; Thanks,<br>
&gt;&gt;&gt; &gt; Yun<br>
&gt;&gt;&gt; &gt; _______________________________________________<br>
&gt;&gt;&gt; &gt; Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
&gt;&gt;&gt; &gt;<br>
&gt;&gt;&gt; &gt; Visit other Kitware open-source projects at<br>
&gt;&gt;&gt; &gt; <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
&gt;&gt;&gt; &gt;<br>
&gt;&gt;&gt; &gt; Please keep messages on-topic and check the VTK FAQ at:<br>
&gt;&gt;&gt; &gt; <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
&gt;&gt;&gt; &gt;<br>
&gt;&gt;&gt; &gt; Follow this link to subscribe/unsubscribe:<br>
&gt;&gt;&gt; &gt; <a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
&gt;&gt;&gt;<br>
&gt;&gt;<br>
&gt;<br>
&gt;<br>
&gt; _______________________________________________<br>
&gt; Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
&gt;<br>
&gt; Visit other Kitware open-source projects at<br>
&gt; <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
&gt;<br>
&gt; Please keep messages on-topic and check the VTK FAQ at:<br>
&gt; <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
&gt;<br>
&gt; Follow this link to subscribe/unsubscribe:<br>
&gt; <a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
&gt;<br>
&gt;<br>
</div></div></blockquote></div><br>