Overlay camera for GUI


I found out that we can use multiple cameras! :heart_eyes:
I would like to use this feature to make an overlay camera that renders certain
objects only. This way I could implement a 3D-GUI without the need of CSS.

Could that be done in future releases?


Masking objects for different cameras is in our roadmap, not sure when it will land at the moment.

One way you can do this is to move or point the UI camera away from the main scene so that it doesn’t render anything else. Set the clear color to have an alpha value and then use the camera priority setting to render one camera in front of the other.

Tried - and it works! :sunglasses:

But masking would be better of course…!

PS: Is your roadmap a secret?
(Coming from Unity I have tons of suggestions :slight_smile: )

It’s not really a secret as much as not really documented.

We love hearing suggestions though so please let us know!

I see.
There´s no official sub forum so what´s the best place to suggest features here?

There is now a Suggestions category :slight_smile:

if you’re adding renderables as custom pc.Command(), you can add this line in callback function (here is example with SpriteRenderer script):

    var command = new pc.Command(pc.LAYER_HUD, this.blendType, function () {
        var entity = this.entity,
            camera = this.cameraEntity;
        // check if current rendering camera is the one your custom renderable is assigned with.
        if (entity.enabled && (camera && camera.camera ? camera.camera.data.isRendering : true)) {
            // render something here.