3D GUI + PP imageProcessingEnabled makes the 3D GUI show on top of all

I spent half of my day deconstructing all of my scene, creating tests and PGs for this.
I couldn’t understand why my 3D GUI layer would show on top of my meshes when, in a simple PG, it doesn’t.

Finally, stumbled over this one. Don’t know if it’s a bug or a restriction (such as i.e. the use of scattering with the 3D GUI) but on the other hand, I did not find any warning or information about this.

So, FYI, and from this PG:

Enabling imageProcessing on the default rendering pipeline makes the 3D GUI be visible though all meshes.
Oh, and then, any solution to fix it (like writting to the buffer or anything) would sure be welcomed.
And then, I guess it would deserve a little line in the doc, wouldn’t it?

3d gui renders in its own layer eg after the scene and if you use a post process it unfortunately applies to the scene only removing the depth information breaking all the rendering of the layer.

The limitation should be added in the doc I guess.

cc @carolhmj

1 Like


Yes, I knew this part of the process from the awesome input of @Evgeni_Popov . I was just hoping there would be some sort of trick/workaround.
And then yes also, I suppose a small warning in the doc for this kind of limitation would probably be a good thing.
Thanks for your answer and have a great day :sunglasses:

you could probably try to share the depth information with a depthRenderer setup on the first scene and inrendering it in a post process on the layer sounds like this could work

Something like this: https://playground.babylonjs.com/#HJZBRG#288


Oh, nice. Thank you.
The fun part is that I don’t really need this imageProcessing (at least not at this point). I wasn’t at the point of PP in my scene. Far of actually. It’s only that I copied it from another project and left it there waiting. Didn’t think it would have an impact. Except the default for the image processing is ‘true’. :wink:

I’m gonna keep this for later and also bookmark it. I’m sure it can also be of help for others.
Thanks again and have a great day :sunglasses:

Hi @sebavan,

I’m finally at the step of implementing post in my scene and I had to return on this one.
I enhanced the PG a little to reflect my struggling with the handling of the cameras and gui for mesh.

Your fix sure works, but I have another question:

In my scene, I have GUI(s) for meshes, FS GUI, 3D GUI and post-processing (from NME and default).
So, usually, from what I’ve learned with @Evgeni_Popov , I’m using two cameras with a layerMask on the FS GUI camera. The scene camera renders the scene + the 3D manager and the GUI camera usually handles just the FS GUI. In this case scenario, the parameters of the gui camera are of no importance since the ADT for FS renders full-screen no matter what.

Now, here comes the part I have been struggling with:

I found that if I follow this logic and attach my cameras in the same way, I could not interact with the GUI for meshes anymore. It took me a very long time to understand why. Finally, I found that if I change some settings on my scene camera but not on the gui camera, all my controls on my ADT for meshes would be offseted. Which brings me to my current solution which I find a bit clumsy:

My solution: Each change I make to the scene camera, I also apply to the GUI camera (so, that they are always sync). It works but then, I have two and will likely have 3 scene cameras and all with user settings. So, this ‘pseudo-solution’ feels a bit clumsy.

My question: Am I doing something wrong taking this approach? Else, is there a way to ‘clone’ the camera so that it will take any changes made to the original?

Could you provide a PG that does not work so that we can try to fix it?

Well, this PG does not work if you uncomment the changes made to ‘camera’ and do not uncomment the same changes made to ‘bgcamera’. Like try to use panning in this version and see the pointer detection being offseted from the button (the ADT for mesh button).

The camera used for pointer events is the last one defined in scene.activeCameras (bgcamera in the PG).

You should set:

scene.cameraToUseForPointers = camera;

to make sure the right camera is used.

Oh, thank you. :hugs: This seems to work indeed. :smiley:
Just a quick question: How is it that if I set this on my scene camera it has no incidence on the FS ADT and I can still use it although its layerMask is set to the one of the ‘bgcamera’?

Edit: This is the working PG that includes your fix.

Edit1: Forget it. I guess it’s because it’s full screen so no matter the camera, the buttons are still at the same place. Is it?

Yes, the only purpose of bgcamera is to be able to sequence the GUI rendering after the first camera. The camera settings are not used for rendering.

All good now. I implemented in my scene and it all works fine (finally) :sweat_smile:
Thanks A LOT to You and also @sebavan @carolhmj and @PolygonalSun for helping me out with this assembly of cameras, pointers, GUIs and PPs.
I would never had made it without your help. You Guys rock :guitar: :metal: :smile:
Have a great weekend :sunglasses:

1 Like