tovacinni/sdf-explorer

Sampling without saving to file

PerryXDeng opened this issue · 1 comments

Is there potentially a way to directly query the SDFs defined in the shader programs with Python instead of having to sample them into files on disk first? This can dramatically decrease the amount of I/O operations and speed things up a bit for some sampling implementations. I have looked into various OpenGL wrappers for Python, including PyOpenGL, all of which don't seem to support calling specific functions (eg. float sdf(vec3 p)) other than void main() from a shader program.

Thanks for your work and looking forward to any advice.

Hi Perry,

Thanks for your interest in our library. You could consider using Glumpy, which allows you to use OpenGL and invoke custom shaders to write to a numpy array. You would just need to pass in some sort of input as a buffer (or make it procedural) and write a main that invokes the SDF.