fogleman / sdf

Simple SDF mesh generation in Python
MIT License
1.6k stars 130 forks source link

SDF Custom 3D Mesh? #15

Open enzyme69 opened 3 years ago

enzyme69 commented 3 years ago

Is there a plan to add ability to import 3D mesh as custom starting volume for SDF?

thegnarwhals commented 3 years ago

You might find this handy: https://github.com/marian42/mesh_to_sdf Once you have your sdf as a numpy array you can create a lookup function and decorate it with sdf.sdf3

tjusxh commented 2 years ago

@thegnarwhals I have a complicated numpy array sdf from mesh_to_sdf. How to translate to sdf.sdf3?

thegnarwhals commented 2 years ago

@tjusxh hi, you will need to create a function that takes in the coordinates and returns the SDF value, and then decorate it with @sdf.sdf3. I’m on my phone right now but let me know if you’re still having trouble tomorrow and I can try point you to some examples when I’m back at my desk. If you look through the source code you should be able to find some examples, for example the sphere.

thegnarwhals commented 2 years ago

@tjusxh you may need to implement some tri-linear interpolation in your function.

emilche commented 2 years ago

I am quite stuck on this one as well. Do you have any pointers in how you would interpolate the outcome. cause it just complains on me that my size of the sdf from the mesh is to big compared to the one that is already there.

VladStojBlank commented 1 year ago

Hi,

Could you please provide a minimal working example how to load a SDF that is generated from a mesh using the mesh_to_sdf library? I am currently trying to do this, but I don't know how to parse the generated numpy array with SDF values and create a new SDF3 object that I can further manipulate.

Any help would be much appreciated!

rawwerks commented 10 months ago

(this repo is so cool!)

+1 for an example of loading a mesh.

the closest i found is this repo, which can use SDF on a STL mesh to create a "TPMS scaffold" => https://github.com/nodtem66/Scaffolder

rawwerks commented 10 months ago

@enzyme69 - i also found these, some are new since your question. sharing the references now because i probably won't have time to try any of these until after the holidays: