Closed LogWell closed 2 years ago
sorry I dont understand your question, you seem to already have separate renderers (not separate windows).
If you want separate windows you can create a new Plotter
object, there are various examples type:
vedo -r multi
sharecam=False
can solve my problem.
test data, rename txt
to zip
.
I use the following code to check the mesh(1. number of vertices is abnormal, 2. faces flip, and so on):
import os
from glob import glob
import openmesh as om
import numpy as np
from vedo import *
path_obj = "/home/lab9/Documents/10520_w_svenja/10520_w_svenja.obj"
obj_dir, obj_name = path_obj.rsplit("/", 1)
vp = Plotter(shape=[1, 2], sharecam=False, offscreen=1)
B = Box(pos=(0, 1.5, 0), length=4, width=3, height=4)
B.color((255, 51, 82)).alpha(0.1)
mesh_1 = load(path_obj)
mesh_2 = mesh_1.clone()
#! at=0
mesh_1.texture(glob(obj_dir + "/tex/*D*")[0])
if 0:
num_v = mesh_1.NPoints()
num_f = mesh_1.NCells()
else:
mesh_om = om.read_trimesh(path_obj)
num_v = mesh_om.n_vertices()
num_f = mesh_om.n_faces()
string = "Scene: 4m(x) x 3m(y) x 4m(z)\n"
string += "Name: " + obj_name
string += ", #V=" + str(num_v)
string += ", #F=" + str(num_f)
T = Text2D(string, font="Courier", s=0.8)
vp.camera.Azimuth(30) # Azimuth/Elevation/Roll #!
vp.show([B, mesh_1], T, at=0, axes=2, zoom=1.5)
vp.show(interactive=0)
#! at=1
mesh_2.c((200, 200, 200))
mesh_2.bc((255, 0, 0))
vp.show([mesh_2], at=1, axes=0, resetcam=True)
vp.show(interactive=1)
screenshot(path_obj[:-4] + "_NGH.png")
vp.close()
Problem 1: if I set offscreen=False
in Plotter(), the result is:
but offscreen=True
is:
When batch processing, offscreen=True
is necessary. How to solve the problem that the mesh on the left has no texture and no transparent box under the current settings.
Problem2: In many cases, NPoints = NCells * 3
, how can I get a result like openmesh
?
Problem3: vp.camera.Azimuth(30)
seems not work.
Hi, this should solve at least 2 problems:
from glob import glob
from vedo import *
settings.useDepthPeeling = True
path_obj = "/home/musy/downloads/10520_w_svenja/10520_w_svenja.obj"
obj_dir, obj_name = path_obj.rsplit("/", 1)
B = Box(pos=(0, 1.5, 0), length=4, width=3, height=4)
B.color((255, 51, 82)).alpha(0.1)
mesh_1 = Mesh(path_obj).texture(glob(obj_dir + "/tex/*D*")[0])
mesh_2 = mesh_1.clone().c((200, 200, 200)).bc((255, 0, 0))
num_v = mesh_1.NPoints()
num_f = mesh_1.NCells()
string = "Scene: 4m(x) x 3m(y) x 4m(z)\n"
string += "Name: " + obj_name
string += ", #V=" + str(num_v)
string += ", #F=" + str(num_f)
T = Text2D(string, font="Courier", s=0.8)
plt = Plotter(shape=[1,2], sharecam=False, offscreen=1)
plt.show(B, mesh_1, T, at=0, axes=2)
plt.camera = plt.renderer.GetActiveCamera()
plt.camera.SetPosition( [4.24, 8.955, 9.389] ) # Press C to get these numbers in the rendering
plt.camera.SetFocalPoint( [0.032, 1.468, 0.032] )
plt.camera.SetViewUp( [-0.206, 0.807, -0.553] )
plt.camera.SetDistance( 12.701 )
plt.camera.SetClippingRange( [6.383, 20.684] )
plt.show(mesh_2, at=1, axes=0)
plt.camera = plt.renderer.GetActiveCamera()
plt.camera.SetPosition( [3.562, 1.478, 1.078] )
plt.camera.SetFocalPoint( [-0.003, 0.901, -0.005] )
plt.camera.SetViewUp( [-0.153, 0.988, -0.023] )
plt.camera.SetDistance( 3.77 )
plt.camera.SetClippingRange( [2.852, 4.934] )
plt.screenshot(path_obj[:-4]+"_NGH.png").close()
The above is a bit of a hack so I will actually classify this as a bug and try to enhance the cam handling in the next release..
Problem2: In many cases, NPoints = NCells * 3, how can I get a result like openmesh?
sorry I have no idea what openmesh
does in this case.. maybe it is related to the presence of normals (?) but I'm not sure about that.
For example, I want to see a global result on the left, and a local result on the right. How to set these two windows?
That is the combination of upper left and lower right: