hyperscientist Posted February 1, 2019 Share Posted February 1, 2019 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! Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted February 1, 2019 Share Posted February 1, 2019 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. Quote Link to comment Share on other sites More sharing options...
themoonrat Posted February 1, 2019 Share Posted February 1, 2019 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. JoeMGomes and ShrewdPixel 1 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.