Saturday, November 5, 2022
HomeGame Developmentcollision detection - Get the closest level on an SDF

collision detection – Get the closest level on an SDF


I imagine that is the video in query: Marble Marcher – A Fractal Physics Recreation.

We will discover the supply code within the description: MarbleMarcher supply code.

Wanting round in foremost, I see right here there’s an UpdateMarble methodology of the Scene class right here. Which in flip calls MarbleCollision.

There we see it makes use of two related strategies:

  • DE: distance estimator.
  • NP: Nearest level.

However it does ray marching, proper? I anticipated there could be some code that makes use of DE for ray marching, however there is not. So appeared for the place does ray marching occur, and – I ought to have anticipated this – it occurs within the GPU. Futhermore, the DE code has a counterpart in a shader right here. However NP doesn’t!

Thus, the sport shouldn’t be getting the closest level from a signed distance area. It’s utilizing an alternate area that provides the closest level (a 3D Vector) as a substitute of the space (a float worth).

The main points of this various area are particular of the fractal, in a similar way that you’ve got devoted capabilities for the signed distance area of various shapes.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments