Search Unity

Moving the camera in a pixel perfect pixel art game

Discussion in '2D' started by Mako23, Sep 8, 2019.

  1. Mako23

    Mako23

    Joined:
    Sep 7, 2015
    Posts:
    4
    I have been trying to figure out pixel perfect movement in Unity for a while no with little to no success. Well, after fiddling around for several nights, my game is pixel perfect and movements are smooth BUT once the camera moves, all hell breaks loose.

    My tile size is 16x16 that is my PPU on every sprite, the pixel perfect camera etc.

    What I did so far:

    - set all sprites to what official Unity Blogposts suggest: 16 ppu, no compression, point filter

    - installed the pixel perfect camera picture, tried several retro resolutions 256×224 , 256x144 , and even 720x480

    - enabled pixel snap on the material (honestly, with the pixel camera this hardly does anything)

    - I read into how they moved the sprites in super mario land on the snes, the basically divide each pixel into subpixels and move their character in a virtual position and align it to the closest pixel on the grid, that what I do, and characters now move pixel perfect across the screen (this and the pixel perfect camera component have given the best results by far)

    - disabled anti aliasing

    - turned off vysnc and locked the fps to 60

    With all this in place, the game looks crisp, movement is smooth and pixel perfect BUT once I move the camera, there is distortion, stutter and artifacts. It is especially bad when moving diagonally. I tried locking the camera position to the closest pixel but this doesn't help. I just don't know what to try anymore. I know it can be done, I just don't know how.

    All the code can be found here: https://github.com/SpaceKuh/reallypixelperfect
    It's messy and all over the place because at this point I have just been experimenting, trying to see what works and what doesn't. I'd be so happy if anybody could help!
     
  2. MazeGames

    MazeGames

    Joined:
    Jul 24, 2020
    Posts:
    1
    I dont know if this is still relevant but if so: You can download the Pixel Perfect package. Its at "Window" then "Package Manager" (you will have to set it to Advanced) and then you only have to download it. Heres the website that helped me with it https://blogs.unity3d.com/2019/03/1...up-your-unity-project-for-retro-8-bits-games/ . Then you have to klick the symbol in the lower right corner at the package window while the 2D pixel perfect package is selected. Just click on the read me txt and you will find further instructions. Good luck!
     
  3. Chris-Trueman

    Chris-Trueman

    Joined:
    Oct 10, 2014
    Posts:
    1,261
    Should read the OP again. They did this, so what you are talking about is redundant. it is also a post from over a year ago. Please pay more attention before posting.