You signed in with another tab or window.Reload to refresh your session.You signed out in another tab or window.Reload to refresh your session.You switched accounts on another tab or window.Reload to refresh your session.Dismiss alert
Augumented Reality iOS app using ARKit and Metal. We use Signed Distance Functions and ray marching to render an animated liquid metal blob floating in the enviroment. Tap on the screen to place the blob.
Signed Distance Functions
Signed Distance Functions (SDF) are a way to describe a 3d object mathematically in terms of the distance from a point to the surface. The sign of the value indicates wether the point is inside or outside of the objects surface. For example, for a sphere we have
We can use SDFs to find the intersection of light ray with the surface of the object. SDFs can be combined in intersting ways (e.g intersection, union, differencet, blend) so that we can create complex shapes without having to use millions of triangles.
Ray Marching in Augumented Reality
In order to do raymarching with our SDFs in Augumented Reality we need to find a light ray coming from the camera for each pixel in the image. We can obtain the princple rays by unprojecting the four corners of the screen onto a plane in front of the camera.:
We can get cube map of the enviroment from the probes enviromentTexture property. This texture is then passed to Metal to render the reflections in our metalic blob.
About
Raytracing with signed difference functions in Augmented Reality