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:
- My points are rendered as squares instead of spheres. Any suggestions on why this happens? Here is my code:
from pythreejs import *
# --points----------------------
ptsCoord = np.array([[-1.0, -1.0, 0.0],
[ 1.0, -1.0, 0.0],
[ 1.0, 1.0, 0.0],
], dtype=np.float32)
pts = BufferAttribute(
array=ptsCoord,
)
geometry = BufferGeometry(
attributes={'position': pts
})
material = PointsMaterial(color='red',
size=1)
pointCloud = Points(
geometry = geometry,
material = material
)
# --rendering----------------------
c = PerspectiveCamera(
position=[0, 5, 5],
up=[0, 1, 0],
children=[DirectionalLight(color='white', position=[3, 5, 1], intensity=0.5)])
scene = Scene(
children=[pointCloud, c, AmbientLight(color='#777777')])
renderer = Renderer(camera=c,
scene=scene,
controls=[OrbitControls(controlling=c)])
display(renderer)
- I am trying to associate a different color to a each point, similarly to what done in this example: https://github.com/mrdoob/three.js/blob/master/examples/webgl_geometry_colors_lookuptable.html (although I want to render a point cloud, not a mesh). How do I instantiate a lut in pythreejs? I get
module 'pythreejs.pythreejs' has no attribute 'Lut'
. Any suggestions on how to implement this?
Thanks a lot!
Serena