Closed sbonaretti closed 6 years ago
The example you link in pt 2 also has square points. What you probably want is to give it a texture for the map
property of the material. E.g. something disc shaped.
The Lut
code is part of the example, and is available here: https://github.com/mrdoob/three.js/blob/master/examples/js/math/Lut.js . It is just a utility for builing a vertex attribute called 'color', as used here:
geometry.addAttribute( 'color', new THREE.BufferAttribute( new Float32Array( lutColors ), 3 ) );
If you are using a BufferGeometry
I would use the examples for that on how to add an attribute, and add an attribute color
from e.g. a numpy array that you fill with the wanted colors.
Hope this helps!
Closing as answered. If you have any remaining questions, feel free to keep commenting!
For those looking to integrate the javascript line above in python, here is how to do it:
def pcl_plot(pts, colors):
pts = BufferAttribute(array=np.asarray(pts, dtype=np.float32))
colors = BufferAttribute(array=np.asarray(colors, dtype=np.float32))
geometry = BufferGeometry(attributes={'position': pts, 'color': colors})
material = PointsMaterial(vertexColors='VertexColors', size=0.1)
pcl = Points(
geometry=geometry,
material=material)
return pcl
Hi,
I am new to pythreejs. I am trying to render a point cloud with a colormap. I am looking at the few available examples in pythreejs and I am trying to translate from the examples in threejs, but I have two main issues:
Thanks a lot!