pyvista / pyvista-support

[moved] Please head over to the Discussions tab of the PyVista repository
https://github.com/pyvista/pyvista/discussions
59 stars 4 forks source link

Question: How to apply multiple textures to a mesh? #433

Open bakkiaraj opened 3 years ago

bakkiaraj commented 3 years ago

Description

I am new to pyvista. Here is my sample code that I currently have to load 3d model and texture,

carmesh: PolyData = pv.read(os.path.abspath(os.path.join(os.path.dirname(__file__), "Porsche_911_GT2.obj")))
#carmesh.translate([0,0,2])
#carmesh.rotate_x(90)
carskin: vtkOpenGLTexture = pv.read_texture(os.path.abspath(os.path.join(os.path.dirname(__file__),"55z27frcahz4-P911GT/skin00/0000.BMP")))
carskin1: vtkOpenGLTexture = pv.read_texture(os.path.abspath(os.path.join(os.path.dirname(__file__),"55z27frcahz4-P911GT/skin00/0000-a.BMP")))
.......
car: vtkOpenGLActor = plotter.add_mesh(carmesh, show_scalar_bar=False, texture=carskin,render=False) # Dont render immediately.
car.SetScale(0.2, 0.2, 0.2)
car.SetPosition(0, -0.50, 0)
car.RotateX(90.0)

Sample output:

image Note that, wheel texture is not applied.

Example Data

The 3d model including texture BMP files are from https://free3d.com/3d-model/porsche-911-gt-43465.html

Question:

Since this particular 3d model has multiple texture BMP files , How to apply all of them using PyVista?