Pixi.js: Pixi 5 Sprite Masks / resolution behaviour

Created on 13 May 2019  路  6Comments  路  Source: pixijs/pixi.js

It seems Pixi 5 behaves differently to Pixi 4 concerning the PIXI.Renderer.resolution value when using masks. I'm not sure if this is a feature or bug, but since I have been unable to find a work around I'm assuming it's a bug?

When PIXI.Renderer.resolution is not 1, the mask will not match the screen size. I'm not talking about the physical dimensions of the mask sprite in the scene, but the pixels treated on screen. No matter of adjusting position, scale or matrix has an impact. So, a resolution of 0.5 means only half the screen actually has the mask act upon it.

A resolution of 2 would mean double the screen size is masked, but since that is beyond the dimensions of the screen nobody is aware of it - other than perhaps slower performance. I also have some older Android tablets that actually refuse to draw the mask altogether, presumably because the resolution is now beyond the GPU chips capabilities. These are some of the early retina displays, with approx 2600x1600... I'm guessing if this is now doubled to 5200x3200 it's beyond the GPU chip max texture size, so the mask and masked content vanishes. This does not happen with my fiddle below as the mask is not large enough, but you can certainly observe the behaviour in action by using resolutions below 1 to help diagnose.

Fiddle: https://jsfiddle.net/fanjules/sb2mzjfk

Set the resolution to 0.5 and you will see the mask is sliced in half! This does not happen in Pixi4.

It's entirely possible I have misunderstood some changes in PIXI5 however, so any clarification warmly received. I have also tried using a PIXI.SpriteMaskFilter and manipulating it's matrix or resolution properties, without effect.

Pixi 5.0.2
Chrome 74
Win 10 64bit

馃暦 Bug

Most helpful comment

I've been working on my game for over 2 years and push the Pixi core quite hard... despite this my transition to Pixi5 was painless so I think you guys are doing a great job. I've found Pixi to be very robust and reliable overall. :)

All 6 comments

Oops.

Agree, both your cases, small resolution and big one are very important. Thank you for closing one more hole that appeared in v5 due a lack of tests.

I've been working on my game for over 2 years and push the Pixi core quite hard... despite this my transition to Pixi5 was painless so I think you guys are doing a great job. I've found Pixi to be very robust and reliable overall. :)

Most of my PR's to v5 are actual ports of my fork of pixijs, so I understand your situation, we are happy to have you here :)

If you give me an email, i can send you invite to pixijs slack, that's where the people share their ideas about filters, shaders, other stuff :)

I have sent you a PM on html5gamedevs :)

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

madroneropaulo picture madroneropaulo  路  3Comments

zcr1 picture zcr1  路  3Comments

Darker picture Darker  路  3Comments

gaccob picture gaccob  路  3Comments

MRVDH picture MRVDH  路  3Comments