How do I render non-blurry Pixels on Mobile?

Get help using Construct 2

Post » Mon Mar 21, 2016 9:58 am

Thank you for your detailed responses @fisholith, I will try this out and hopefully come back with a good outcome :)

Just one question, how does construct 2 actually realize the scaling? Is the final canvas object in the DOM scaled to fullscreen or is the canvas always fullscreen and just the intermediary calculated texture upscaled inside webgl?
B
6
Posts: 34
Reputation: 318

Post » Mon Mar 21, 2016 3:16 pm

I think I found the problem. Apparently setting Use high-DPI display to yes solves the problem :) I have yet to see if this comes with any performance impact...
B
6
Posts: 34
Reputation: 318

Post » Wed Mar 23, 2016 9:21 am

Interesting.

So, from what I gather, "Use high-DPI display" forces the browser to ignore the "device-pixel-ratio" specified by the mobile device.

For instance, the Galaxy s6 normally scales everything up by 4x (device-pixel-ratio of the s6) to make webpages readable, but with "Use high-DPI display" enabled, it will instead render everything at 1x scale, or more importantly, 1-to-1 pixel density with the display's native resolution.

That kind of makes sense, as you were seeing the full screen view of your game rendered at exactly 1/4th the display resolution, and then scaled up by 4x (device-pixel-ratio of the s6) to fit the screen. By coincidence your game at 1x scale happened to also be exactly 1/4th the display's resolution, which perfectly hid what was going on. :D

The device-pixel-ratio is a fixed scaling factor determined by the device manufacturer, but is different for different devices. This scaling factor came about as a way to scale websites to a reliably readable size across different devices and display resolutions.

The description for the "Use high-DPI display" property is as follows,
"Use high resolution display where available. If disabled, renders in low-res and upscales."
So when enabled it renders directly at native resolution.

Back towards the end of 2013 Construct 2 "r148" was released, and the high-DPI option became a project default. In the release notes Ashley explained the following:
"This build broadens support for any device with a high-DPI display, including modern Android phones and tablets, Tizen and Blackberry 10 devices, and Amazon tablets. Graphics can render at considerably better quality with high-DPI support, and especially text which can appear much crisper and more readable.

Since high-DPI displays have many more pixels, using this mode can reduce performance since there is more rendering work for the GPU. So we've kept it as an option, but renamed from "Use iOS retina display" to "Use high-DPI display". It's on by default and we highly recommend using it whenever possible, but in some cases you may need to turn it off for performance to be acceptable."
(https://www.scirra.com/construct2/releases/r148)

As he points out, it's theoretically possible to see a performance gain from turning it off, but it's essentially required for correct rendering on devices that use a scaling factor (device-pixel-ratio), and it's also worth noting that the performance effect was negligible enough back in 2013 to make it enabled by default. So in 2016 you should be pretty safe leaving it enabled, especially since it fixes the blur problem.

[ edit ]
Here's an interesting article on "device-pixel-ratio":
http://juiceboxinteractive.com/ideas/a- ... e-devices/
B
27
S
18
G
8
Posts: 328
Reputation: 6,158

Post » Wed Mar 23, 2016 10:15 am

Wow thank you for the thorough analysis! The other nice effect of enabling high dpi was that now finally the return values of touch.x are actually correct and I do not need to do some calculations where I had to divide by the actual rendering height vs the original rendering height etc. So if anyone is struggling with any of these issues -> enable high dpi :)
B
6
Posts: 34
Reputation: 318

Post » Wed Mar 23, 2016 10:58 am

No worries. And thanks for sharing your findings, SirPumpAction. Very helpful to know. :)
... also I love your avatar.
B
27
S
18
G
8
Posts: 328
Reputation: 6,158

Post » Wed Mar 23, 2016 1:41 pm

Thanks, he was from another game project that is currently on hold until I've finished this one :)
B
6
Posts: 34
Reputation: 318

Previous

Return to How do I....?

Who is online

Users browsing this forum: Exabot [Bot], Kin, mikehive, ratboy3, tinhofiel and 38 guests