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
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.
Thanks, @ChrisIceBox! 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.
Excellent guide, thanks! Would also be welcome on the AC wiki, I'm sure.