Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Runtime generated SDF
#4
Recently got back to this feature and I am happy to say it finally works! I required only very minor changes to the engine to integrate it.

I added this interface
Code:
public interface IExtendedColliderHandler
{
    public JobHandle GenerateContacts(ObiColliderWorld world,
        BurstSolverImpl solver,
        NativeList<Oni.ContactPair> contactPairs,
        NativeQueue<BurstContact> contactQueue,
        NativeArray<int> contactOffsetsPerType,
        float deltaTime,
        JobHandle inputDeps);
}

public class DummyExtendedColliderHandler : IExtendedColliderHandler
{
    public JobHandle GenerateContacts(ObiColliderWorld world, BurstSolverImpl solver, NativeList<Oni.ContactPair> contactPairs,
        NativeQueue<BurstContact> contactQueue, NativeArray<int> contactOffsetsPerType, float deltaTime, JobHandle inputDeps)
    {
        return inputDeps;
    }
}

And after every built in collider evaluation i run this:
Code:
inputDeps = extendedColliderHandler.GenerateContacts(world, solver, contactPairs, colliderContactQueue, contactOffsetsPerType, deltaTime, inputDeps);

In the awake I just added the dummy handler should the collider world init before my external code.
Code:
if (extendedColliderHandler == null) extendedColliderHandler = new DummyExtendedColliderHandler();

My collision handler has one low resolution SDF and a virtual high resolution SDF. The high resolution is requested near the camera and built from the displaced terrain mesh which is a whole topic on its own. The mesh to sdf solution is based on a project from Unity's demo team but with heavy modifications.

Check it out here! I have a video of it in action and another showing the debug visualisation:

https://drive.google.com/file/d/16UbBW6L...sp=sharing

Also, I'm wondering if I may share all this in a devlog on my Youtube channel? I'm asking permission because I want to dive pretty deep in technicals and that includes how Obi works. No code sharing of course, except maybe how I integrated with the collider world if that is okay?

Thanks again for the guidance Josemendez!
Reply


Messages In This Thread
Runtime generated SDF - by goosejordan - 10-03-2025, 09:56 PM
RE: Runtime generated SDF - by josemendez - 11-03-2025, 08:12 AM
RE: Runtime generated SDF - by goosejordan - 11-03-2025, 02:30 PM
RE: Runtime generated SDF - by goosejordan - 10-11-2025, 09:47 AM
RE: Runtime generated SDF - by josemendez - 10-11-2025, 02:14 PM