Forum rules - please read before posting.

Mantaining pixel ratio with depth

I am doing an old-style point and click adventure game using pixel art, and I have noticed that the character scale will shrink the character pixel ratio as well, making the character pixels look smaller the further away he gets.
How difficult would it be to scale the player maintaining the pixel-ratio constant?
Thanks in advance! :)

Comments

  • I think you'd just have to set the resolution of your game to be the same as your artwork.  Otherwise, I wouldn't know - perhaps this has been discussed in the official Unity forum.
  • Hi guys!

    I think fulviov was talking about pixel-perfectness, which is hard/impossible to achieve in unity at the moment. Old games (like the original SCUMM games) had only 320x200 pixels, so the resolution of the character sprites went down when they were scaled. I faced the same problem when i ported a AGS game to AC. My personal solution: In the future I only create "flat" scenes where the characters don't need to be scaled down at all.

    image

  • edited September 2019

    Anyone know if there has been any progress with the dynamic scaling in later versions of Unity? The built-in pixel perfect camera solves many problems but the imperfect scaling seems to still be an issue. I'd really like to avoid having to write custom sprite shaders, but maybe there's just no way around it?

  • Welcome to the community, @Clifftopgames.

    Not that I'm aware of, other than scaling down the actual render resolution.

    However, as this is a topic that extends beyond AC, there may be answers on the Unity forums.

  • edited September 2019

    Thanks, @ChrisIceBox! :smile: As for anyone else running into this issue, I managed to get proper scaling by using the render to texture method outlined here: https://adventurecreator.org/forum/discussion/6253/resize-and-pixel-perfection

    Brief guide:
    1. Create a render texture in the exact size as your native resolution.
    2. Assign it to a quad stretched up to match the dimensions of your main camera (which should be your native resolution multiplied with your PPU).
    3. Put the quad on a z layer higher than all your sprites.
    4. Position your main camera directly on the quad and set the clipping plane to only pick up the z level with the quad on it.
    5. Create a secondary render camera with the same position and size as your main camera, but with a lower clipping plane to pick up your sprites and ignore the quad.
    6. Assign the render texture to the render camera.
    7. Make sure the render camera has the AC GameCamera2D component and assign it to your scene manager so scrolling and such works correctly.
    8. Also move the AudioListener component from your main camera to the render camera, so any audio in the scene matches the scrolling.
    7. Hide the quad and the main camera in the hierarchy (they will always be static anyway) so they are out of the way when you work with the scene.
    8. Prefab according to your needs and you're done!

    *Edit realized that the pixel perfect scaling breaks the GameCamera2D component is added to the render camera. I'll see if I can find a workaround and post the full solution on the AC wiki.

  • edited September 2019

    Excellent guide, thanks! Would also be welcome on the AC wiki, I'm sure.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.