Search Unity

Correct way to provide crisp 2D sprites

Discussion in '2D' started by fendercodes, Jul 20, 2019.

  1. fendercodes

    fendercodes

    Joined:
    Feb 4, 2019
    Posts:
    191
    We are building a 2D top down game with art that needs to be rendered perfectly crisp. A game that we are using as a reference for art style is Swords of Ditto.

    ss_a996cae2913589e0a919b835f468939c5c4e62ed.1920x1080.jpg

    We want to support the following resolutions that can be changed via in-game options:
    • 1280 x 720 (720p)
    • 1920 x 1080 (1080p)
    • 3840 × 2160 (4k)
    The tilemap grid for our game should scale the same across all resolutions at 10 units vertically. So, this would mean tiles would need the following PPU:
    • 720p: 72PPU
    • 1080p: 108PPU
    • 4k: 216PPU
    I'm thinking that we need to change the camera's orthographic size based on the resolution picked and switch out the sprites used. Ideally, we would only need to export 1 version of our sprites (e.g. 216x216 for 4k) and then switch out to the lower PPU version based on the resolution.

    What is the easiest way to achieve this in Unity as it stands today? I've read about sprite atlases and asset bundling but not entirely sure how that all ties together.
     
  2. fendercodes

    fendercodes

    Joined:
    Feb 4, 2019
    Posts:
    191
    I'm looking into Master and Variant sprite atlases and thinking that's the best thing here?

    I'll need to somehow load in the correct atlas dynamically when the user switches resolution from our in-game options menu.
     
  3. AlanDavison

    AlanDavison

    Joined:
    Jul 4, 2013
    Posts:
    1
    How are you handling the source, original sprites? I assume you're not intending to have different detail levels for your sprites per display resolution?

    If you do just have the one source size for sprites, you're looking at the problem in a terribly inefficient way! In that case, all you should really need is the Unity pixel perfect camera from Github.
     
  4. fendercodes

    fendercodes

    Joined:
    Feb 4, 2019
    Posts:
    191
    @AlanDavison That's correct, we were only planning on one source size for sprites. We've been creating our sprites at the max resolution.

    Currently our tiles are 240x240px so that we can have 16 x 9 tiles visible on the screen at a 4K resolution. The plan was then to somehow have 120x120px versions for 1080p resolutions and 72x72px for 720p.

    But the pixel perfect camera can automatically do the scaling for us without lowering quality and the amount of our level visible in the camera?