Hello everyone,
I’m really excited about this project!
I work in the geometry processing area, I’d love to use streamlit
to visualize 3D data (point clouds and triangular meshes) and functions defined over such 3D data.
Some examples of the visualizations I’m speaking of are the following:

Usually I use MATLAB to do this. When I have to use python (e.g. when using PyTorch) I use open3D or this library.
Can I do this kind of visualizations using streamlit
? I’m sure a lot of people would love this.
I understood that streamlit
has a wrapper over deck_gl
, which supports a PointCloudLayer
.
I’d like to start by using this layer to plot point clouds.
I found an example of usage of this layer in javascript here.
However, I’m not familiar with javascript
or deck_gl
and I don’t seem to be able to make it work.
This is a sketch of the code. The strange data format is what seems to be required by the deck_gl
API, but I might be wrong.
vertices = mesh.v
normals = mesh.estimate_vertex_normals()
data = [{
'position': vertices[i],
'normal': normals[i],
'color': np.abs(vertices[i]) / 256,
} for i in list(range(mesh.v.shape[0]))]
def getposition(x):
return x['position']
def getnormal(x):
return x['normal']
def getcolor(x):
return x['color']
st.deck_gl_chart(
layers=[{
'id': 'pointCloud',
'radiusPixels': 1,
'type': 'PointCloudLayer',
'data': data,
'getPosition': getposition,
'getNormal': getnormal,
'getColor': getcolor,
}])
And this is the error I’m getting:
Do you have any idea?
I don’t have to make it work, if there are easier ways to plot point clouds or, even better, triangular meshes
Thanks!
edit.
Here another working example, in javascript: https://deck.gl/#/examples/core-layers/point-cloud-layer
Code here: https://github.com/uber/deck.gl/tree/7.3-release/examples/website/point-cloud
From what I understood, I should use OrbitView: https://deck.gl/#/documentation/deckgl-api-reference/views/orbit-view
Is it possible to do this in streamlit?