Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Texture over a mesh #1212

Open
ManuGraiph opened this issue Dec 17, 2024 · 3 comments
Open

Texture over a mesh #1212

ManuGraiph opened this issue Dec 17, 2024 · 3 comments

Comments

@ManuGraiph
Copy link

Hi Marco,

Quick question.. it's possible to apply a texture/image over a mesh in vedo? Like in pyvista when you plot a mesh with an image applied over its elements.

Thanks in advance!

@marcomusy
Copy link
Owner

Yes of course!

vedo --search texture
--> examples/advanced/geological_model.py:
77	top_granitoid_vertices = Points(xyz).generate_delaunay2d().texture(dataurl+'textures/paper2.jpg')
96	boundary.lw(0).texture(dataurl+'textures/wood1.jpg')
--> examples/advanced/gyroid.py:
0	"""A textured gyroid shape cut by a sphere"""
14	gxs.texture('https://vedo.embl.es/examples/data/images/marblings.jpg')
--> examples/basic/shadow1.py:
5	spider.texture(dataurl+'textures/leather.jpg')
--> examples/basic/texture_coords.py:
0	"""Assign texture coordinates to a polygon"""
12	# texture coordinates, one (u,v) pair for each vertex:
19	# apply texture to m
21	m.texture(
--> examples/basic/texturecubes.py:
1	Show a cube for each available texture name.
2	Any jpg file can be used as texture.
6	textures_path = dataurl+'textures/'
9	print('example textures:', textures_path)
12	cubes.append(Cube().texture(textures_path+'leather.jpg'))
13	cubes.append(Cube().texture(textures_path+'paper2.jpg'))
14	cubes.append(Cube().texture(textures_path+'wood1.jpg'))
15	cubes.append(Cube().texture(textures_path+'wood2.jpg'))
--> examples/pyplot/plot_fxy1.py:
16	f2 = plot(f, texture=dataurl+'textures/paper3.jpg')
26	    texture=dataurl+'textures/paper1.jpg',

@ManuGraiph
Copy link
Author

Thanks a lot, i'll give it a try tomorrow!!

@ManuGraiph
Copy link
Author

Sorry to reopen, i checked the examples and i'm basically doing something like:

mesh = vd.open(mesh_path)
mesh.texture(texture_path)

And then i'm trying to visualize it, but i can't.. i'm trying show(mesh), or creating a Plotter(object), but when i try to show it, i just get:

<vedo.plotter.Plotter object at 0x7a6b8324cf50>

I'm guessing i'm missing the plot backend for vedo, but i'm not sure how to fix it.

@ManuGraiph ManuGraiph reopened this Dec 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants