rgl-epfl / differentiable-sdf-rendering

Source code for "Differentiable Signed Distance Function Rendering" (Siggraph 2022)
BSD 3-Clause "New" or "Revised" License
861 stars 53 forks source link

where to find the result mesh #2

Closed dumppool closed 2 years ago

dumppool commented 2 years ago

After finishing trainning,I could not find where is the result mesh generated by optiomization. Which folder contain the final mesh? how to dump the gid parameters into result mesh?

dvicini commented 2 years ago

Hi,

The outputs are all written into subdirectories of differentiable-sdf-rendering/outputs/. The optimized SDF itself will be in the params subdirectory of the optimization's output folder. The format of the result is a mitsuba volume file (*.vol) storing the SDF values. This can be converted to a mesh using marching cubes (e.g., from scipy).

Hope that helps Delio

dumppool commented 2 years ago

thanks for relpy

Yannnnnnnnnnnn commented 2 years ago

a few lines of code:

import mcubes
import trimesh
import numpy as np

import mitsuba as mi
mi.set_variant('cuda_ad_rgb', 'llvm_ad_rgb')

vol_path = None # your path to vol
ply_path = None # your path to save ply
loaded_data = np.array(mi.VolumeGrid(vol_path))
vertices, triangles = mcubes.marching_cubes(loaded_data, 0.0)
mesh = trimesh.Trimesh(vertices, triangles)
trimesh.repair.fix_inversion(mesh)
mesh.export(ply_path)

image