Pages

Camera with Signed Distance Field

 The camera uses the local SDF to guide itself, attempting to stay at least a fixed distance away from the nearest surface, while also avoiding obstructions that may be blocking the view of the players body.  

When moving away from a surface it uses the gradient of the SDF to determine the direction to move in. 

It also computes the lipchitz bounds to accommodate and correct for bad distance fields.

 The player also moves using (semi) camera relative controls, so the movement of the camera needs to be very smooth and predictable. 

  The design uses two virtual arms, one extending upward from the players body, and the 2nd, connected to the top of the first, extends backward. Left/right with mouse spins the first, while Up/Down moves the 2nd. It feels like a first person camera while actually being third person.

I apply temporal smoothing in a few places to prevent jittery behavior.