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

Help implementing 3D SDF/UDF fitting #36

Closed
lykius opened this issue Feb 9, 2022 · 5 comments
Closed

Help implementing 3D SDF/UDF fitting #36

lykius opened this issue Feb 9, 2022 · 5 comments

Comments

@lykius
Copy link

lykius commented Feb 9, 2022

Hi,
This framework is really amazing, thanks a lot for sharing it.

I've been playing around with samples/mlp_learning_an_image.cu and I was wondering if it is possible to adapt it in order to fit a point cloud or a mesh by fitting its UDF/SDF.
I'm not really expert in CUDA programming, do you think it's doable with a reasonable effort? Do you have any suggestion?
I was thinking about computing coordinates and groundtruths in python and saving them in numpy files, then loading these numpy files inside the CUDA program (with cnpy). But after that, I'm not sure about the next steps. In the image case, you create a CUDA texture that seems quite specific for 2D images, how should I adapt it to 3D data?

Thanks in advance for any kind of help,
Luca

@Tom94
Copy link
Collaborator

Tom94 commented Feb 11, 2022

Hi, absolutely! In our instant-ngp project, we've implemented a number of neural graphics primitives using this framework, one of which is indeed an SDF. You can run it and pass it a .obj-formatted mesh and it'll fit a corresponding SDF within a second or so + give you a live rendering preview.

Over in that project, see testbed_sdf.cu for the SDF-specific source code.

@lykius
Copy link
Author

lykius commented Feb 11, 2022

Hi @Tom94, thanks a lot for your answer!

I know instant-ngp, it's super awesome!! I was trying to use tiny-cuda-nn since I'm currently interested in a more general MLP formulation, without hash encoding. Maybe I can start from the SDF fitting in instant-ngp and remove the hash encoding. What do you think?

@Tom94
Copy link
Collaborator

Tom94 commented Feb 11, 2022

instant-ngp's SDF code uses tiny-cuda-nn's NetworkWithInputEncoding, which can use any encoding that you'd like. All you need to do is change out the encoding in the .json configuration that you pass to the program via the --network argument. It loads <task>/base.json by default, where <task> is sdf in this case.

@lykius
Copy link
Author

lykius commented Feb 11, 2022

Ok I'll try that!
Thanks a lot, I really appreciate your help!

@Tom94
Copy link
Collaborator

Tom94 commented Feb 11, 2022

Gladly!

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

2 participants