Apologies if there is some obvious way to do this, but I could not find it. I have searched the bug tracker and asked on Riot and Discord. I understand not many people are making split-screen games at this day and age.
Godot version:
3.0.6
Issue description:
I am using a split-screen setup for local multiplayer, but I need some objects to be invisible to some players. This doesn't seem to be possible, short of duplicating the whole scene and all its objects.
It would be nice to have a way to do this, either by hiding some objects before drawing happens for a specific viewport/camera, or only rendering a specific group on each viewport/camera, etc.
If this is possible, at least a doc improvement seems required (which I'm happy to help with!)
Steps to reproduce:
Have multiple viewports rendering the same scene (via setting the world property from code).
I believe you can achieve this using layers. Each camera has a cull mask property and each VisualInstance (e.g. MeshInstance) has a layer property. The camera will only render objects that are on the same layer as its cull mask.
Do you want to do it on 3D or 2D? 2D may be harder because there are no visual layers, but maybe you can try using a light as a mask to hide or show objects.
I am doing 3D.
Thanks! Those "layers" look like what I was looking for. I guess my search terms were all "groups" or "hierarchy", and I never found this (I also looked over Node and Spatial but not VisualInstance).
I will try this, and see if there is a way I can make this more discoverable for the next person.
Thanks again for the fast response!
Transferred the issue to the docs repository as the feature works already, it just needs to be better documented.
From a quick glance at the docs, I'd say we need:
[member cull_mask] is used to define what [VisualInstance]s will render in this Camera, based on their [member VisualInstance.layers] (this should be done in Camera.xml in the engine repo)Transferred the issue to the docs repository as the feature works already, it just needs to be better documented.
From a quick glance at the docs, I'd say we need:
- Improve the documentation of the Camera class to mention in its Description that the
[member cull_mask]is used to define what[VisualInstance]s will render in this Camera, based on their[member VisualInstance.layers](this should be done inCamera.xmlin the engine repo)- Improve the Viewports tutorial to mention this too, likely in the Camera section.
per EON-S this might not be possible in 2D as cameras do not have visual layers. I am personally looking for a feature like this in 2D. If the 2D case is not the same as the 3D case (i.e. just update the docs), is it worth expanding the scope here to include an implementation of view layers in 2D?
Most helpful comment
Transferred the issue to the docs repository as the feature works already, it just needs to be better documented.
From a quick glance at the docs, I'd say we need:
[member cull_mask]is used to define what[VisualInstance]s will render in this Camera, based on their[member VisualInstance.layers](this should be done inCamera.xmlin the engine repo)