Skip to content

Change pointcloud opacity with pointdata dict #737

Answered by marcomusy
jkissi asked this question in Q&A
Discussion options

You must be logged in to vote

Hi J
points are also cells by themselves so, check out
https://github.com/marcomusy/vedo/blob/master/examples/basic/colorMeshCells.py

from vedo import *

#settings.use_depth_peeling = True

pts = Sphere().clean().points()
tor = Points(pts, r=20)
#tor.render_points_as_spheres(False)

rgba = np.random.rand(tor.ncells, 4)*255 # RGBA values

colorlist = rgba.astype(np.uint8)  # note the uint8 type
tor.celldata["mycols"] = colorlist
tor.celldata.select("mycols")

show(tor).close()

Also note the shortcut:

# ...
rgba = np.random.rand(tor.ncells, 4)*255 # RGBA values
tor.cell_individual_colors(rgba)

show(tor).close()

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@jkissi
Comment options

Answer selected by jkissi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants