libigl-python-bindings icon indicating copy to clipboard operation
libigl-python-bindings copied to clipboard

What do I replace meshplot with, in case not using Jupyter-notebook?!

Open ShMonem opened this issue 4 years ago • 2 comments

ShMonem avatar Dec 30 '21 09:12 ShMonem

II am very new to libigl-python-bindings. Trying to run the tutorials, I found that "meshplot" can be used with Jupyter-notebook while no plots show when I use Pycharm or the teminal, instead I get the printed text you will find below!

how do I plot meshes if I am using for instance pycharm and not Jupyternotebook?

========================================================================== Renderer(camera=PerspectiveCamera(children=(DirectionalLight(color='white', intensity=0.6, position=(0.0, 0.0, 2.598076211353316), quaternion=(0.0, 0.0, 0.0, 1.0), rotation=(0.0, 0.0, 0.0, 'XYZ'), scale=(1.0, 1.0, 1.0), up=(0.0, 1.0, 0.0)),), fov=30.0, position=(0.0, 0.0, 2.598076211353316), projectionMatrix=(1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0), quaternion=(0.0, 0.0, 0.0, 1.0), rotation=(0.0, 0.0, 0.0, 'XYZ'), scale=(1.0, 1.0, 1.0), up=(0.0, 1.0, 0.0)), controls=[OrbitControls(controlling=PerspectiveCamera(children=(DirectionalLight(color='white', intensity=0.6, position=(0.0, 0.0, 2.598076211353316), quaternion=(0.0, 0.0, 0.0, 1.0), rotation=(0.0, 0.0, 0.0, 'XYZ'), scale=(1.0, 1.0, 1.0), up=(0.0, 1.0, 0.0)),), fov=30.0, position=(0.0, 0.0, 2.598076211353316), projectionMatrix=(1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0), quaternion=(0.0, 0.0, 0.0, 1.0), rotation=(0.0, 0.0, 0.0, 'XYZ'), scale=(1.0, 1.0, 1.0), up=(0.0, 1.0, 0.0)), target=(0.0, 0.0, 0.0))], scene=Scene(children=(PerspectiveCamera(children=(DirectionalLight(color='white', intensity=0.6, position=(0.0, 0.0, 2.598076211353316), quaternion=(0.0, 0.0, 0.0, 1.0), rotation=(0.0, 0.0, 0.0, 'XYZ'), scale=(1.0, 1.0, 1.0), up=(0.0, 1.0, 0.0)),), fov=30.0, position=(0.0, 0.0, 2.598076211353316), projectionMatrix=(1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0), quaternion=(0.0, 0.0, 0.0, 1.0), rotation=(0.0, 0.0, 0.0, 'XYZ'), scale=(1.0, 1.0, 1.0), up=(0.0, 1.0, 0.0)), AmbientLight(intensity=0.5, position=(0.0, 0.0, 0.0), quaternion=(0.0, 0.0, 0.0, 1.0), rotation=(0.0, 0.0, 0.0, 'XYZ'), scale=(1.0, 1.0, 1.0), up=(0.0, 1.0, 0.0)), Mesh(geometry=BufferGeometry(attributes={'color': <BufferAttribute shape=(2368, 3), dtype=float32>, 'index': , 'position': <BufferAttribute shape=(2368, 3), dtype=float32>}), material=MeshStandardMaterial(alphaMap=None, aoMap=None, bumpMap=None, defines={'STANDARD': ''}, displacementMap=None, emissiveMap=None, envMap=None, flatShading=True, lightMap=None, map=None, metalness=0.25, metalnessMap=None, normalMap=None, normalScale=(1.0, 1.0), polygonOffset=True, polygonOffsetFactor=1.0, polygonOffsetUnits=5.0, roughnessMap=None, side='DoubleSide', vertexColors='VertexColors'), position=(0.0, 0.0, 0.0), quaternion=(0.0, 0.0, 0.0, 1.0), rotation=(0.0, 0.0, 0.0, 'XYZ'), scale=(1.0, 1.0, 1.0), up=(0.0, 1.0, 0.0))), fog=None, overrideMaterial=None, position=(0.0, 0.0, 0.0), quaternion=(0.0, 0.0, 0.0, 1.0), rotation=(0.0, 0.0, 0.0, 'XYZ'), scale=(1.0, 1.0, 1.0), up=(0.0, 1.0, 0.0)), shadowMap=WebGLShadowMap()) interactive(children=(IntSlider(value=0, description='t', max=14), Output()), _dom_classes=('widget-interact',))

No error or warnings!**

ShMonem avatar Dec 30 '21 09:12 ShMonem

Hi,

The message you see is the pythreejs representation of the scene.

In general, 3d scenes are nontrivial to display in terminals.

However, we provide an offline mode, that saves the plot to an HTML file.

vw = mp.plot(v,f)
vw.save("temp.html")

jiangzhongshi avatar Feb 05 '22 15:02 jiangzhongshi

I'd recommend polyscope:

import igl
import polyscope as ps
v,f = igl.read_triangle_mesh('input.obj')
ps.init()
ps.register_surface_mesh(name="input",vertices=v,faces=f)
ps.show();

(closing this old issue; feel free to reopen if not resolved by comments above)

alecjacobson avatar Feb 06 '23 00:02 alecjacobson