New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mask behaviour when there are nested containers. #3673
Comments
even if you have sprite in container mask isn't working
|
From the docs:
|
Hi Rich , But as i explained above , I can see the mask being applied ( as intended ) to the Image objects nested in the containers, but the text objects are not even being rendered at all. Also from #3491 , I see a quote mentioning |
My comment was directed at the post above by @RollinSafary which clearly has a child of a container with a mask enabled on it, which isn't going to work. It doesn't entirely surprise me that a container within a container doesn't pick-up the parent mask properly, but I'll need to spend time creating some tests to see it happening. Also, there's no way the input system can tell if an object is masked from view or not, so you're absolutely going to have to deal with that situation yourself, regardless of the outcome of the main part of this issue. |
Hi Rich , |
Masks in v2 were all geometry based, do you see the same thing happen with containers with a geometry mask? (and yes, if you have a demo that'd be extremely useful) |
Hi Rich, |
Disappointing... I decided to move my games to phaser 3 and I've also found this. When I have global parent container (I'm using it for scaling all game objects) and want some child to be masked - seems I can't do that. The heart is broken :( |
@flahhi it's resolvable, you can extend from |
@RollinSafary I did't quite understand what you said. |
@photonstorm . Hi Rich. Any update on this :) ? |
No, not yet. Like I said, I need to spend time creating examples to reproduce this, because yours was far too large for what is needed for debugging. Example code should be isolated and as tiny as possible. |
Here is an example with an additional container and the mask doesn't work because not supported, like Rich said. @photonstorm , @kanthi0802 if you guys have time, please check the example, maybe it helps with debugging Also, I found one more weird thing. Here is another example: And here is the basics how the mask works : |
@photonstorm . the example mentioned above is the same as the one mentioned in #3722. I'm afraid I cannot make it simpler. But i'm attaching screen shots so that you get an idea. This occurs when there is a container nesting ( Phaser.AUTO mode ), meaning A parent container ---- N number of children which are also containers --- Each child container has three text objects and an image as children.This occurs almost in a similar way but there are not text objects added to the child container ( Phaser.AUTO mode ) , meaning This occurs when there is a container nesting ( Phaser.CANVAS mode ), meaning |
@flahhi . Gone through the examples. Removing the strokeRect gives a painting effect indeed. Looks good actually :) . But this happens only in CANVAS mode . In AUTO mode it works like it is intended to. :). I'm not equipped to say why there is a difference in CANVAS and AUTO modes |
Hi, @photonstorm . We are also facing a similar kind of issue. Any updates on this?. It would be very helpful to us if this issue gets fixed. |
This would be great! |
Hi @photonstorm, we are facing similar issue, could you please look into this ASAP, it would be a great help, if we have a fix. |
@photonstorm, any update on this ? |
same |
Maybe related. Maybe a different issue. I have a similar use case, scrolling lists that need to be clipped against something. It would appear that any form of masking on an object is ignored if the object is in a container. For example, take the labs sample, https://labs.phaser.io/view.html?src=src\display\masks\geometry%20mask\multiple%20image%20mask.js, and add the first image to a container
The original labs sample has the hash mark masking all the graphics, with the above change the hash mark ignores the graphic in the container even though it is still added. |
This is correct, in so much as it's always been like this and is mentioned specifically in the documentation. It's not great, but until I rewrite both Containers and the way masks work (or someone submits a PR), it's going to remain like it for now. |
Shame, I am running into this issue too |
Came across this issue as well. It's preventing setting up sorting layers and UI elements such as progress bars, carousels, etc from being grouped together and animated around the screen. |
I wanted and needed this functionality too. You can modify the container render function to apply child masks in much the same way that masks are applied in the scene render loop of the root display list. This will give you a little more functionality to be able to apply a mask further down the container tree, rather than only at the root. But, this will not handle the correct reapplication of masks as the container traversal moves passed the child mask and back up towards the root. For that, there needs to be a proper mask manager to reapply higher level masks after lower level masks have been passed. I also noticed a problem with spines, they kill any masking when they restore the pipeline after rendering, eg to a masked container add a spine and then some other images (or spines), result only the 1st spine gets masked. Having a proper mask manager could also solve this problem. Also worth mentioning is Rex's Container Lite, it works differently but may work enough for some. It's worth noting that it applies the mask to every child render rather than just once for the container, there'll be a performance hit for this. |
The new Geometry Mask system is now in the master branch. It has a proper mask stack and will support child - parent depths up to 255 levels deep (the same as Phaser 2). Masks are also batched to avoid redundant stencil ops, which has improved performance massively across the board. You can see this in the following tests: http://labs.phaser.io/view.html?src=src%5Cdisplay%5Cmasks%5CContainer%20Mask%20Test%203.js&v=dev and http://labs.phaser.io/view.html?src=src%5Cdisplay%5Cmasks%5CMask%20Perf%20Test.js&v=dev (warning: swapping the perf test demo back to 3.16 may crash some browsers!) |
@photonstorm just tried again and noticed that spines with their own clipping that are inside containers do not apply the clipping, but if outside a container then their own clipping works. Does the spine runtime work with the new mask system and should work, or is this an existing limitation? |
@photonstorm How can I apply this feature when target is |
@scott20145 Bitmap Masks are WebGL only. Geometry Masks are both WebGL and Canvas. |
Hi,
We have a component kind of List. It basically extends Container and creates children which are also of type Containers. Each of these children contain a background image and some text objects to display data, they are aligned vertically in the parent list container. Now the issue is when we are trying to apply mask to the parent container , the text children in second level containers are not being rendered at all. Only the background image is rendered.
Further more input events seems to be working on the game objects which are masked .
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
The text was updated successfully, but these errors were encountered: