Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to render multiple arranged meshes of fixed height

See original GitHub issue

I want to arrange multiple meshes in order along the x-axis to render an image with a fixed height. The width of the image is calculated according to the length of the mesh after arrangement, and I want these grids to occupy the whole picture.

I have many different meshes, so I want to deal with this problem in a more determined way, rather than by setting the zoom parameters.

data(replace “.txt” with “.zip”)


import igl
from vedo import *

settings.rendererFrameAlpha = 0
settings.useParallelProjection = True  # avoid perspective parallax

color_meshlab = [

# path_mesh = "/home/lab0/Pictures/for_vedo_20221105/CCD_mesh_d_ortho_00000_0_opt_0.ply"
path_mesh = "/home/lab0/Pictures/for_vedo_20221105/CCD_mesh_d_ortho_00003_0_opt_0.ply"

path_mesh_1 = path_mesh
path_mesh_2 = path_mesh
path_mesh_3 = path_mesh
path_mesh_4 = path_mesh

v0, f0 = igl.read_triangle_mesh(path_mesh_2)
v1, f1 = igl.read_triangle_mesh(path_mesh_2)
v2, f2 = igl.read_triangle_mesh(path_mesh_3)
v3, f3 = igl.read_triangle_mesh(path_mesh_4)

mean0 = v0.mean(0)
max0 = v0.max(0)
min0 = v0.min(0)

d = max0 - min0
dx = d[0]  # width of mesh
ddx = 0.1  # Gaps between meshes, here we set as 0.1m

# Decentralization
if True:
    v0 -= mean0
    v0 -= min0

    v1 -= mean0
    v1 -= min0

    v2 -= mean0
    v2 -= min0

    v3 -= mean0
    v3 -= min0

# Arrange along the x-axis
if True:
    v1[:, 0] += (dx + ddx) * 1
    v2[:, 0] += (dx + ddx) * 2
    v3[:, 0] += (dx + ddx) * 3

M0 = Mesh([v0, f0])
M1 = Mesh([v1, f1])
M2 = Mesh([v2, f2])
M3 = Mesh([v3, f3])


# dx ddx-dx ddx-dx ddx-dx
h = d[1]
w = 4 * dx + 3 * ddx
h += 0.2  # margin
w += 0.2

# Fixed height, the width is calculated according to the x-axis length of the meshes
h0 = 800
hw = h0
ww = int(h0 * w / h)

show([M0, M1, M2, M3], zoom=1.0, size=(ww, hw), offscreen=0)

result: check_0

desired: check_0

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:11 (5 by maintainers)

github_iconTop GitHub Comments

marcomusycommented, Nov 6, 2022

Nice, you are very welcome to make a pull request if you wish!

The difference is that show() by default makes a call to reset_camera() so it nullifies the first call to it. The equivalent would be:, resetcam=False)

marcomusycommented, Nov 5, 2022

have you tried

show(..., zoom="tight")
# or
show(..., zoom="tightest")

you may need to update vedo with:

pip install vedo -U
Read more comments on GitHub >

github_iconTop Results From Across the Web

geometry - OpenGL -- Render multiple meshes, with individual ...
1 Answer 1 ... You don't need one VBO per object. Just concatenate all the objects into one single VBO or just a...
Read more >
Mesh Rendering - Vulkan Guide
The main idea of the system is that rendering is done through a MeshPass , a given mesh pass holds the information needed...
Read more >
Tessellation Chapter I: Rendering Terrain using Height Maps
When terrain (without any caves or overhangs) is being rendered, a mesh can be perturbed based on a height map. The height map...
Read more >
Three.js Multiple Canvases Multiple Scenes
One more solution would be to render to an off screen canvas and copy the result to a 2D canvas at each element....
Read more >
Mesh Renderer component - Unity - Manual
To render a deformable mesh, use a Skinned Mesh Renderer instead. In C# code, the MeshRenderer class represents a Mesh Renderer component. The...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found