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