RedBall
RedBall

Reputation: 319

Visualizing 3d models with textures

I have a textured 3d model which has an obj file , mtl file and a png image for textures . I can visualize them without textures using trimesh and vtkplotter as :

//trimesh//
m = trimesh.load("3dmodel.obj")

//vtkplotter//
m = load("3dmodel.obj")

But they display the 3d models as plain meshes . I want to see them along with textures .

Can anyone please help me View the 3d models along with textures . Any small help would be greatly helpful .

Upvotes: 3

Views: 6403

Answers (3)

mmusy
mmusy

Reputation: 1337

You can try the following:

from vedo import load

# https://free3d.com/3d-model/091_aya-3dsmax-2020-189298.html
mesh = load("091_W_Aya_100K.obj").texture("tex/091_W_Aya_2K_01.jpg")
mesh.lighting('glossy') # change lighting (press k interactively)

mesh.show()

enter image description here

Upvotes: 4

Ali Ganjbakhsh
Ali Ganjbakhsh

Reputation: 801

you can act like this:

import numpy as np
import trimesh
from PIL import Image

im = Image.open("Lmobl/texture.png")
mesh = trimesh.load('Lmobl/raw_model.obj',process=False)
tex = trimesh.visual.TextureVisuals(image=im)
mesh.visual.texture = tex
mesh.show()

and here the result: enter image description here

and for without texture, you'll find answer here

Upvotes: 2

Mathieu Westphal
Mathieu Westphal

Reputation: 2643

You can just use f3d for that : https://gitlab.kitware.com/f3d/f3d/-/releases

f3d /path/to/3dmodel.obj

Upvotes: 1

Related Questions