Replies: 3 comments 10 replies
-
|
Hi, yes I don't see why that should not be possible! |
Beta Was this translation helpful? Give feedback.
5 replies
-
|
Hi @ttsesm import natsort
import glob
import vedo
folder = "data/ttsem_files/"
mesh_files = natsort.natsorted(glob.glob(folder + "*.obj"))
texture_files = natsort.natsorted(glob.glob(folder + "*.png"))
print(f"Found {(mesh_files)} meshes and\n{(texture_files)} textures.")
meshes_projected = []
x0m, x1m, y0m, y1m = (1e10, 0, 1e10, 0)
for mesh_file, texture_file in vedo.progressbar(zip(mesh_files, texture_files)):
m = vedo.Mesh(mesh_file).texture(texture_file).lighting("off")
mx = m.project_on_plane("z").alpha(1)
meshes_projected.append(mx)
x0, x1, y0, y1, _, _ = m.bounds()
x0m = min(x0m, x0)
x1m = max(x1m, x1)
y0m = min(y0m, y0)
y1m = max(y1m, y1)
box = vedo.Box([x0m, x1m, y0m, y1m, 0, 0]).alpha(0)
sizex = 800
sizey = (y1m - y0m) * sizex / (x1m - x0m)
vedo.settings.screenshot_transparent_background = True
vedo.settings.use_parallel_projection = True
plotter = vedo.Plotter(offscreen=True, size=(sizex, sizey))
plotter.show([box, meshes_projected[0]], zoom="tightest")
plotter.screenshot("mesh0.png")
plotter.remove(meshes_projected[0]).add(meshes_projected[1]).render()
plotter.screenshot("mesh1.png")
plotter.close()
# check if the screenshots are correct
plt = vedo.Plotter(size=(sizex, sizey))
plt.show(vedo.Image("mesh0.png", channels=4),
vedo.Image("mesh1.png", channels=4), zoom="tightest").close()note that you can do |
Beta Was this translation helpful? Give feedback.
1 reply
-
|
Hi
..just ideas :) |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment













Uh oh!
There was an error while loading. Please reload this page.
-
Hi @marcomusy,
One question, I would like to use the
project_on_plane()method in order to project a mesh on a 2D plane but I would like to understand if I can do that with a mesh loaded with texture so that I can keep the texture of the projected surface. Is that possible?Beta Was this translation helpful? Give feedback.
All reactions