Jump to content

What is the benefit of using 'resolution' property?


hyperscientist
 Share

Recommended Posts

Hello, I'm in the process of setting up renderer so it covers whole range of devices and naturally I looked into 'resolution' property of the Renderer. Initially it worked well, but as my code evolved I started to realize it doesn't really help or simplify anything. Today most high end mobiles have ~1440p screens and lets say my device has a devicePixelRatio is 3. What difference does it make to my wellbeing as a developer if my screen has a virtual height of 1440px or 480px? Especially that there is a drawback: with roundPixels set to true (for performance reasons) it lowers the resolution of objects positioning which doesn't really make sense if we want to utilize high resolution screens (and we do since we set resolution to >1). What am I missing? Is this a legacy feature? Just trying to understand, so I would be grateful if you could share your thoughts!

Link to comment
Share on other sites

Nothing, just a handy variable: stage does not depend on resolution. CSS pixels (480p), width/height is stored in "renderer.screen.width" , real pixels  (1440p), stored in "renderer.view.width". You have also check "PIXI.settings.RESOLUTION" and "PIXI.settings.FILTER_RESOLUTION" because some features use global settings. "renderer.resize" also takes care of CSS resize if you use "autoResize:true" setting (look in source of SystemRenderer for resize method).

Other renderer engines have this variable too.

Link to comment
Share on other sites

Imagine you create a game at 1920x1080, which runs fine on most devices, but you have some older ones you want to support that aren't performing up to scratch and never will. Ok, well, set the resolution to 0.5, which can also trigger the loader to use @0.5 textures you have provided, and very quickly you have something that can run on lower performing devices. And then you're game gets picked up and you're going to a show to put your game on a big screen. Set the resolution to 2, which can also trigger the loader to use @2 assets provided, and you now have a 4k native resolution game with minimum fuss.

It's also possible, with a small amount of hackery, to change this resolution property dynamically on the renderer. A lot of video games do that these these days ... they have a target resolution, but will lower it if performance starts to suffer to get the fps back up. And once the fps comes up and is stable, it'll raise the resolution back to it's target again.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...