hello,
I want to import obj and mtl files in python-vtk 8.1.2,but I find the texture picture in mtl is not be loaded.
This is my code:
import vtk
def main():
objimporter = vtk.vtkOBJImporter()
objimporter.SetFileName(“test3.obj”)
objimporter.SetFileNameMTL(“test3.mtl”)
objimporter.SetTexturePath(“E:\CT\vtk\3D-reconstruction-from-CT-DICOM-using-python-VTK\”)
renderer = vtk.vtkRenderer()
renderer.UseHiddenLineRemovalOn()
renWin = vtk.vtkRenderWindow()
iren = vtk.vtkRenderWindowInteractor()
renWin.AddRenderer(renderer)
renWin.SetWindowName(“OBJImporter”)
actor = renderer.GetActors()
actor.InitTraversal()
iren.SetRenderWindow(renWin)
objimporter.SetRenderWindow(renWin)
objimporter.Update()
actor = renderer.GetActors()
renWin.Render()
renderer.ResetCamera()
iren.Start()
if name == ‘main’:
main()
and this is my mtl file:Blender 3.5.1 MTL File: ‘None’
www.blender.org
newmtl Material.002
Ns 250.000000
Ka 0.129909 0.129909 0.129909
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 2.050000
d 1.000000
illum 3
map_Kd /1.jpg