MeshUDF icon indicating copy to clipboard operation
MeshUDF copied to clipboard

Meshing Non-learned UDFs

Open nynyg opened this issue 5 months ago • 2 comments

Thanks a lot for the awesome contribution to the community!

I understand that the context of the project is more relevant to learned UDFs. However, I wonder if / how we can mesh an exact UDF (e.g., a HxWxD tensor) using the tools you provide?

Thanks a lot!

nynyg avatar Jan 08 '24 23:01 nynyg

Hello, Yes you can use our meshing procedure on an exact UDF, provided you also have their spatial gradients. We tried and discussed it in the supplementary (Sec. 5.4): with an exact UDF, most artefacts disappear (holes, staircases...).

You can simply pass your exact UDF values and their gradients to udf_mc_lewiner:

from _marching_cubes_lewiner import udf_mc_lewiner

udf_values = np.array(...)
gradients = np.array(...)
voxel_size = ...

verts, faces, _, _ = udf_mc_lewiner(udf_values,
                                    gradients,
                                    spacing=[voxel_size] * 3)

Hope it helps, Benoit

bguillard avatar Jan 09 '24 12:01 bguillard

Thanks! Yes, that helps a lot!

nynyg avatar Jan 19 '24 23:01 nynyg