Hello,
I’m using vtkOBJImporter to display an obj file. I have an associated .mtl file which references various roughness, normals, diffuse texture .pngs etc.
VTK succesfully displays the .obj file and I can clearly see the contents of the diffuse texture are included but it seems like the normals and roughness are not being processed - the image is completely flat.
I’m using Python and VTK 9.2.2 on Windows and the code I’m using is shown below.
Any ideas on why the normals/roughness are not being processed?
Thanks in advance,
Doug
def main():
# Get the full pathname of the vtp file containing the cow definition from the res folder
current_file_path = os.path.dirname(os.path.realpath(__file__))
objfname=os.path.join(os.path.dirname(current_file_path), r'res\snowman\snowman_finish.obj')
matfname=os.path.join(os.path.dirname(current_file_path), r'res\snowman\snowman_finish.mtl')
texturepath=os.path.join(os.path.dirname(current_file_path), r"res\snowman")
# Set up the importer and initialize with the files
objimporter=vtkOBJImporter()
objimporter.SetFileName(objfname)
objimporter.SetFileNameMTL(matfname)
objimporter.SetTexturePath(texturepath)
# Render window, renderer and interactor
renderer=vtkRenderer()
renwin=vtkRenderWindow()
renwin.AddRenderer(renderer)
iren = vtkRenderWindowInteractor()
iren.SetRenderWindow(renwin)
# Connect the importer to the render window
objimporter.SetRenderWindow(renwin)
objimporter.Update()
# Render
iren.Initialize()
renwin.Render()
iren.Start()
if __name__=='__main__':
main()