Open3D icon indicating copy to clipboard operation
Open3D copied to clipboard

Is there a way to show overlapped point cloud with transparency (alpha channel)?

Open ShuangjunLiu opened this issue 6 years ago • 4 comments

If I want to show two point cloud overlap each other. Is there a way to show them in a transparent way? Like add alpha channel to them.

I tried to generate 4 channel which doesn't work.
Thanks.

ShuangjunLiu avatar Jun 04 '20 23:06 ShuangjunLiu

Until there is a true implementation of opacity or transparency, you could try to play with the point sizes (+ and - key on a standard qwerty keyboard, on any other keyboard: the two keys left of the backspace-key). Together with the paint_uniform_color method, you could create a similar visualization to show how two point clouds overlap.

GnnrMrkr avatar Jun 08 '20 08:06 GnnrMrkr

This is supported in Open3D 0.11. You can assign an alpha channel to your pointclouds and they can be rendered with a LIT material. For the UNLIT case we are still working on it.

germanros1987 avatar Nov 03 '20 01:11 germanros1987

@germanros1987 I couldn't find how to assign alpha channels to the point clouds from the document. Could you please share an example? Thanks!

bearpaw avatar Jul 06 '21 18:07 bearpaw

@bearpaw this is such an example from StackOverflow: https://stackoverflow.com/a/78292710

import numpy as np
import open3d as o3d

# Create three random point clouds
rng = np.random.default_rng()
pts1 = rng.random((100, 3), dtype=np.float32)
pts2 = rng.random((100, 3), dtype=np.float32)
pts3 = rng.random((100, 3), dtype=np.float32)
t1 = o3d.core.Tensor(pts1)
t2 = o3d.core.Tensor(pts2)
t3 = o3d.core.Tensor(pts3)
pcd1 = o3d.t.geometry.PointCloud(t1)
pcd2 = o3d.t.geometry.PointCloud(t2)
pcd3 = o3d.t.geometry.PointCloud(t3)

mat1 = o3d.visualization.rendering.MaterialRecord()
mat1.shader = 'defaultLitTransparency'
mat1.base_color = [1.0, 0.0, 0.0, 0.5]  # RGBA, adjust A for transparency
mat1.point_size = 20.0
mat2 = o3d.visualization.rendering.MaterialRecord()
mat2.shader = 'defaultLitTransparency'
mat2.base_color = [0.0, 1.0, 0.0, 0.3]  # RGBA, adjust A for transparency
mat2.point_size = 20.0
mat3 = o3d.visualization.rendering.MaterialRecord()
mat3.shader = 'defaultLitTransparency'
mat3.base_color = [0.0, 0.0, 1.0, 0.1]  # RGBA, adjust A for transparency
mat3.point_size = 20.0

clouds = [{'name': 'pcd1', 'geometry': pcd1, 'material': mat1},
          {'name': 'pcd2', 'geometry': pcd2, 'material': mat2},
          {'name': 'pcd3', 'geometry': pcd3, 'material': mat3}]

# o3d.visualization.draw uses open3d.visualization.O3DVisualizer to display the geometries
o3d.visualization.draw(clouds, bg_color=(0.1, 0.1, 0.1, 1.0), show_skybox=False)

zimonitrome avatar May 28 '25 07:05 zimonitrome