You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
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
Windows 10
Issue description
Canvas item with layer other than 1 cannot be seen unless "Canvas Cull Mask" value include layer 1.
Looks like setting any value without the layer 1 active on a viewport just hide everything.
Note :
My guess is that there is an issue with how the cull flag are handled, the value may be tested as a bool somewhere.
After more test i found the issue, the layer visibility from parent taken into account, children are not tested if layer visiblity test fail in parents
Steps to reproduce
Change
Visibility Layer
of Canvas Item to something else than 1.
Try changing the value of
Canvas Cull Mask
of your viewport
Minimal reproduction project (MRP)
ViewportVisibilityLayers.zip
@JonqsGames
This is not a bug and the intended behavior. It's a bit monotonous, but there is no inherit-visibility-layer setting, so each canvas item and every one of its decedents needs to be set explicitly to the visibility layer it should show on. Of course, if you have a good proposal though for a better workflow, I'd love to take a look!
Perhaps it'd be better to have an inherit-from-parent dropdown like some of our other settings that would disable or ignore the set visibility layers? You would probably have the same amount of setup as all the other ideas, but while we couldn't add it as default without breaking compatibility, you could set it on all your nodes generally without having to keep track of specific layers and be able to reparent it to another viewport without having to change anything.
I may be missing some context, but that sounds like a more reasonable and familiar workflow. If popular, we could make it the default eventually. Seems like it'd be more common to want to inherit by default and only need to set it in special cases.
@markdibarry
Mentionned that solution but i think it may be more complex to implement and i disagree on what the default behavior should be.
I understand that all CanvasItem are kind of visual (mainly due to possibility of Y sorting) but i think the behavior should be the same than for the visual layer in 3D.
Here is an update of the reproduction project to show the difference between 2D and 3D:
ViewportVisibilityLayers (2).zip
My final point on this matter, right now i'm not sure that anyone is using this, most people watch tutorial and online ressources that push to other solution (Have two separate worlds, using RemoteTransform2D ...). So i think the behavior should be changed, i made the simplest proposal but any other solution that prevent me from checking the whole arborescence to check the right layer will be good for my usecase.
I may be underestimating (I usually am), but I don't think it'd be that complex to implement (I also might just be getting excited about a smoother workflow for parallax 😆 ). Since visibility_layer is handled on one line in the culling, the harder part would just be making the dropdown option:
I think it'd be worth having an easier workflow for visibility, but you're right about 2D and 3D being just so crazy different in their whole workflow. From looking around the UI it feels like any attempt to align is gonna lead to a ton of more problems. For example, visibility is handled on a per-node basis (any canvas item) for 2D via "visibility layer", but it's handled specifically on the Camera3D node via "cull mask". I'd be interested to know what all would need to change to make the workflows look intuitively similar, but my guess is a lot. 🫠
I think it's worth exploring the inheritance method since it fits into our current concepts in other nodes, and for your scenario, you'd just need to change the value of one node. Then again, I could be totally missing something, but at least for split screens this would make the workflow pretty nice rather than having to go through all decedents and change them to the specific layer.
Can anybody explain the reasoning behind visibility layers depending on inheritance to begin with? I would have expected it to work like other bitmask settings, and just search the whole tree, rendering or not rendering nodes according to their individual settings, completely ignoring the hierarchy. Any other default behavior seems very counterintuitive.
Principle of rendering in 2D is a bit different, in 3D we have depth sorting but in 2D rendering order is done by exploring the node tree downward. There is option to mitigate that (See
Ordering
parameters of a CanvasItem) and option to handle things differently called Y-Sorting.
That's why the simplest solution was choosen for that: using inheritance. In the current implementation if VisibilityLayer test fail, the downward exploration stops (and the whole branch is ignored).
So to have the behavior you describe, a big change in the way node are rendered would be needed. That's why for now keeping inheritance maybe easier.