-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Q: How to set min/max for colormap when rendering a pointcloud? #2545
Labels
Comments
This is possible using the new API. @errissa could you please provide an example? |
Hi @maxfreu please upgrade to the latest Open3D v0.14.1. Here is sample code for using the color gradient with the new API: import open3d as o3d
from open3d.core import Tensor, concatenate
from open3d.visualization import rendering, draw
from open3d.ml.vis import Colormap
# Create a helix point cloud. We will use the Z values to assign colors.
values = Tensor.arange(start=0.0, stop=1.0, step=0.001,
dtype=o3d.core.float32).reshape((-1, 1))
period = 0.2
xyz = concatenate(
((6.28 / period * values).sin(), (6.28 / period * values).cos(), values), 1)
pcd = o3d.t.geometry.PointCloud(xyz)
# Use a special point property to specify colormap lookup values for the point
# cloud.
pcd.point['__visualization_scalar'] = values
# Use a default rainbow colormap
colormap = Colormap.make_rainbow()
# Add alpha channel and convert to Gradient Points
colormap = list(
rendering.Gradient.Point(pt.value, pt.color + [1.0])
for pt in colormap.points)
# Now create the material
material = rendering.MaterialRecord()
material.shader = "unlitGradient"
material.gradient = rendering.Gradient(colormap)
material.gradient.mode = rendering.Gradient.GRADIENT
material.scalar_min = 0.0
material.scalar_max = 1.0
draw({
'name': 'helix',
'geometry': pcd,
'material': material
},
point_size=3,
show_skybox=False) |
Thanks! It will take a while until I come around to trying it out, but good to know it works now. I leave it at your descretion to close the issue. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi! I would like to set the range of the colormap when rendering a pointcloud; I only want a color gradient from e.g. z=0 to z=1 although there are points above and below that region. Is this currently possible? If yes, how?
Edit: I am using v0.9.0 btw
The text was updated successfully, but these errors were encountered: