Hello Guest

Author Topic: How to display same amount of pixels on different resolutions  (Read 4786 times)

Serge

  • Newbie
  • *
  • Posts: 12
    • View Profile
How to display same amount of pixels on different resolutions
« on: December 20, 2015, 03:20:07 pm »
Hey,
when my game is played on a resolution that is a multiple of my native's resolution and i scale down an sprite, you can see more pixel then you could in the native resolution.
As displayed in the attachment, the first sprite is the my sprite with a scale of (1,1) - the second sprite has a Scale of (1, 0.5) how it is displayed right now in the game: you can still see all the pixels of the sprite, just scaled down.

The 3rd sprite displays how i want it to be: You would see the same result independent if you play the game in the native resolution or a multiple of it. How can i achieve that?

edit: Attachments seem no to work...
« Last Edit: December 21, 2015, 09:26:45 pm by Serge »

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: How to display same amount of pixels on different resolutions
« Reply #1 on: December 27, 2015, 12:59:37 am »
The only way to do this properly is to render into a low resolution render texture on the camera. As you're actually rendering into a target with the exact number of pixels being displayed, downscaled images will render as you want them.

Serge

  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: How to display same amount of pixels on different resolutions
« Reply #2 on: February 24, 2016, 07:54:37 pm »
thanks so far,
i finally found time to try around with Render Texture and i have the following issue:

If an object in my game has an off float position (like 5.5) it is displayed sharp if i don't render to texture (the bars displayed left on my attachment)

But if i render onto RenderTexture for some reason the image drawn onto the texture is different then the one that is displayed directly (the right bar displayed right in my attached image has a y position of .5)



any idea what causes that?

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: How to display same amount of pixels on different resolutions
« Reply #3 on: March 02, 2016, 09:34:20 am »
What is the filtering mode on your sprite textures? Do you have mipmaps on?

Serge

  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: How to display same amount of pixels on different resolutions
« Reply #4 on: March 12, 2016, 06:56:07 pm »
Found the issue:
While my render quality settings had anti alising disabled, my render texture had still anti alising on - that was the difference between rendering onto texture or directly onto screen :)
« Last Edit: March 12, 2016, 07:21:56 pm by Serge »

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: How to display same amount of pixels on different resolutions
« Reply #5 on: March 14, 2016, 11:14:02 pm »
Ah that makes sense. Having AA on screws up edges.