Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can't even run through the sample code... #32

Open
yawning-lion opened this issue Feb 13, 2022 · 0 comments
Open

can't even run through the sample code... #32

yawning-lion opened this issue Feb 13, 2022 · 0 comments

Comments

@yawning-lion
Copy link

yawning-lion commented Feb 13, 2022

thanks a lot for the great library!
I try to run sample code in terminal of ubuntu, but I just can't get proper result.
86411d7aaba8b428954615532ecece9
'''
from mesh_to_sdf import mesh_to_voxels

import trimesh
import skimage

mesh = trimesh.load('chair.obj')

voxels = mesh_to_voxels(mesh, 64, pad=True)

vertices, faces, normals, _ = skimage.measure.marching_cubes(voxels, level=0)
mesh = trimesh.Trimesh(vertices=vertices, faces=faces, vertex_normals=normals)
mesh.show()
'''
2cbba96d0562cabbc6b0900ce35b0e1
'''
from mesh_to_sdf import sample_sdf_near_surface

import trimesh
import pyrender
import numpy as np

mesh = trimesh.load('chair.obj')

points, sdf = sample_sdf_near_surface(mesh, number_of_points=250000)

colors = np.zeros(points.shape)
colors[sdf < 0, 2] = 1
colors[sdf > 0, 0] = 1
cloud = pyrender.Mesh.from_points(points, colors=colors)
scene = pyrender.Scene()
scene.add(cloud)
viewer = pyrender.Viewer(scene, use_raymond_lighting=True, point_size=2)
'''
I'm totally a noob there, and I'm wondering what's wrong with it.
someone can help?
I'll greatly apprieciate your help😭

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant