Talk:VTK/FAQ

From KitwarePublic
< Talk:VTK
Revision as of 23:05, 4 August 2008 by Chirod (talk | contribs) (vtk3DSImporter usage.)
Jump to navigationJump to search

When 3ds file the import doing, it wants expressing with the wireframe. Do to do how, when to teach it will be grateful.

m3dsReader->SetRenderWindow(renWin);
m3dsReader->SetFileName(szFullPath);
m3dsReader->ComputeNormalsOn();
m3dsReader->Read();

thank you

vtk3DSImporter usage.

The code you listed above seems to be the only way that the vtk3DSImporter class can be used. I have some additional questions that I would like some input on.

I used the vtk3DSImporter as described above. I converted a 3D Studio Max (.max) file into a 3DS (.3ds) format so that I could import within VTK. However, the color schemes are not matching up because the original .max file contains sub-materials instead of just materials. I found the vtk3DSImporter.cxx file and extracted some of the code within the class and used it after executing vtk3DSImporter->Read. I traversed the meshlist, material property list, and created actors. I assigned the correct material to each actor. I also traversed the polyData list and assigned a transform filter to each polyData item. I added each item to a vtkAppendPolyData variable.

This takes a long time within the code, but I can translate and rotate the 3DS file after it has been imported. But the color schemes are wrong, mostly coming out white or transparent.

Has anyone figured out how to accomplish this properly? I find it hard to believe that vtk3DSImporter is only used for just seeing what a 3DS file looks like. The object should be available within vtk for translating, scaling, and rotating.

I also converted the 3DS file to a .obj (Wavefront) file. A material file is created which specifies the ambient, diffuse, and specular colors for each material. The .obj file specifies which material is to be used with each face. However, the vtkOBJReader class does not even use the .mtl file. Hence, one gets no color with each face. I also checked the vtkOBJReader.cxx file and it ignores the .mtl file altogether.

Has anyone figured out a way to use the .mtl file within the vtkOBJReader class?

Thanks