Talk:VTK/FAQ: Difference between revisions

From KitwarePublic
Jump to navigationJump to search
No edit summary
 
 
(6 intermediate revisions by 4 users not shown)
Line 8: Line 8:


thank you
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
= Offscreen rendering =
The information spread along the web regarding offscreen rendering in VTK is quite obsolete. While I've compiled Mangled Mesa myself in the past, I knew it was no longer necessary. However, all the information in the web says the opposite.
I think one big question say : HOW DO I OFFSCREEN RENDER?
and the simple answer for VTK 5.X: just use the following code
<code>
vtkSmartPointer<vtkRenderWindow> RenderWindow = vtkSmartPointer<vtkRenderWindow>::New();
RenderWindow->SetOffScreenRendering(1);
</code>
would be more than enough to help users.
--[[User:Drunken sapo|Drunken sapo]] 18:55, 17 August 2010 (UTC)
:There is an example here: http://www.vtk.org/Wiki/VTK/Examples/Cxx/Utilities/OffScreenRendering . The problem is that if you do only that (and not all of the stuff with GraphicsFactory and ImagingFactory), a black window still pops up. [[User:Daviddoria|daviddoria]] 20:02, 17 August 2010 (UTC)
== How can I build and execute an example in Visual C++ 2008 ==
I am a beginner of VTK user.
I use: Operating system Windows XP, Microsoft Visual C++ 2008 express edition,
Cmake 2.8, VTK 5.6.1
After compiling VTK, I build Cone.c++ example from :\VTK\Source\Example\Tutorial\Step1\Cxx\Cone.cxx then Visual C++ gave the following error:
Unable to start program C:\VTK\Source\Example\Tutorial\Step1\Cxx\Cone.cxx
The specified file is an unrecognized or unsupported binary format
Please give the solution
== How can I build and execute VTK example in visual c++ 2008 ==
How can I build and execute VTK example in visual c++ 2008 after compiling VTK

Latest revision as of 07:04, 19 July 2011

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

Offscreen rendering

The information spread along the web regarding offscreen rendering in VTK is quite obsolete. While I've compiled Mangled Mesa myself in the past, I knew it was no longer necessary. However, all the information in the web says the opposite. I think one big question say : HOW DO I OFFSCREEN RENDER? and the simple answer for VTK 5.X: just use the following code vtkSmartPointer<vtkRenderWindow> RenderWindow = vtkSmartPointer<vtkRenderWindow>::New(); RenderWindow->SetOffScreenRendering(1); would be more than enough to help users. --Drunken sapo 18:55, 17 August 2010 (UTC)

There is an example here: http://www.vtk.org/Wiki/VTK/Examples/Cxx/Utilities/OffScreenRendering . The problem is that if you do only that (and not all of the stuff with GraphicsFactory and ImagingFactory), a black window still pops up. daviddoria 20:02, 17 August 2010 (UTC)

How can I build and execute an example in Visual C++ 2008

I am a beginner of VTK user.

I use: Operating system Windows XP, Microsoft Visual C++ 2008 express edition, Cmake 2.8, VTK 5.6.1

After compiling VTK, I build Cone.c++ example from :\VTK\Source\Example\Tutorial\Step1\Cxx\Cone.cxx then Visual C++ gave the following error: Unable to start program C:\VTK\Source\Example\Tutorial\Step1\Cxx\Cone.cxx The specified file is an unrecognized or unsupported binary format


Please give the solution

How can I build and execute VTK example in visual c++ 2008

How can I build and execute VTK example in visual c++ 2008 after compiling VTK