Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

Pixel Snapped Camera for UE4

A topic by Handkor created Aug 04, 2017 Views: 995
Viewing posts 1 to 1
(2 edits)

From what I posted here

https://twitter.com/SuccubiinHats/status/892629420447592449

I made a camera for use in 3D games that eliminates pixel swimming. It allows your mesh to render like sprites and the background to stay static as you move the camera around. The camera can also be used topdown, isometric or from the side as long as there is no Roll on the camera itself.


To use:

  1. Place the camera in your world and orient for your needs.
  2. Implement PixelSnappableInterface on all your pawns.
  3. Pawns should decouple their mesh from the collision and return the mesh through the interface. The camera will adjust the mesh to snap to the pixels.

Google Drive

To reimplement this in other programs, all you need to do is create an orthographic camera and transform the locations of your dynamic meshes with the inverse transformation matrix of the camera, then snap XYZ in camera local space to [Camera Orthographic View Width]/[resolution] increments and finally transform back into world space with the camera's transformation matrix. The camera's location also needs to be snapped the same way as your meshes.

Note: The current follow implementation is not very good and causes some jittering. This camera works best when moved by the player or on it's own.