zju3dv / NeuMesh

Code for "MeuMesh: Learning Disentangled Neural Mesh-based Implicit Field for Geometry and Texture Editing", ECCV 2022 Oral
https://zju3dv.github.io/neumesh/
MIT License
380 stars 13 forks source link

Visualization of signed distance fields #10

Closed JiaxiongQ closed 1 year ago

JiaxiongQ commented 1 year ago

This is a great work! How do you draw the SDF field in Fig.3 of your paper?

ybbbbt commented 1 year ago

Hi, you can first get a slice of SDF values, for example:

x = np.linspace(xmin, xmax, N)
y = np.linspace(ymin, ymax, N)
z = np.linspace(zmin, zmax, N)
xyz_ = np.stack(np.meshgrid(x, y, z), -1)
xyz_ = xyz_[:, int(N * 0.5), :]
sdf = model(xyz_.reshape(-1, 3)).reshape((N, N))

and use matplotlib plt.contour with Spectral colormap to draw the SDF field:

plt.contour(x, z, sdf, np.linspace(-0.2, 0.7, 30), cmap="Spectral")
JiaxiongQ commented 1 year ago

Thanks for your reply! I will close this issue.