02-09-2024, 10:01 AM
(This post was last modified: 02-09-2024, 10:04 AM by josemendez.)
(30-08-2024, 11:34 PM)sam3dx Wrote: By any chance, can OBI generate SDF on runtime?
It can, but not in realtime. Building an adaptive SDF is a very expensive operation.
(30-08-2024, 11:34 PM)sam3dx Wrote: Or maybe I can I use some third party tools to generate distance fields that can be used by OBI?
Unity's MeshToSDF tool: https://github.com/Unity-Technologies/co...esh-to-sdf
It will generate a SDF from a mesh in realtime. Note that MeshToSDF's output is not very high-res (64^3), while Obi's SDFs can be very high-resolution (512^3, or even 1024^3), so the resolution might not be enough for your use case. Also keep in mind that the SDFs generated by this tool are regular 3D textures, which means they have a constant amount of detail and pretty high memory consumption, while Obi's SDFs are adaptive: they use an octree-like structure with nodes of different sizes, that yield finer resolution in areas where greater detail is needed.
You should be able to write a component that creates a Obi SDF where all leaf nodes for a given subdivision level exist, then copy each node's distance data from a regular 3D texture. This will make Obi able to use a SDF generated in realtime in the GPU.
kind regards,