royibernthal Posted March 24, 2018 Share Posted March 24, 2018 HighlightLayer is in front of GUI AdvancedDynamicTexture.CreateFullscreenUI() with foreground set to true, is there a way for GUI to be in front of it? Quote Link to comment Share on other sites More sharing options...
Wingnut Posted March 25, 2018 Share Posted March 25, 2018 Hi R! Sorry for the slow replies. I have no solutions, just a testing PG: https://www.babylonjs-playground.com/#UQ73E1#70 Experiments in lines 50 & 91. HighLight and Glow layers... not designed to be depth-sorted, I hear. Let's invite Admiral @Sebavan to visit and comment, if he wishes. He's a highlightLayer "founding father". (He's also a nice guy and a genius, but don't tell him any of that... he might get big-headed and tip-over.) Quote Link to comment Share on other sites More sharing options...
Dad72 Posted March 25, 2018 Share Posted March 25, 2018 Can be using the layerMask would solve this problem Quote Link to comment Share on other sites More sharing options...
royibernthal Posted March 25, 2018 Author Share Posted March 25, 2018 @Wingnut Thanks for the testing I appreciate it @Dad72 Could you please elaborate? @Deltakosh @Sebavan I was thinking it might be nice to have this behavior built-in in bjs since the whole point of the full screen gui is to be in front of everything else. What do you think? Quote Link to comment Share on other sites More sharing options...
Dad72 Posted March 26, 2018 Share Posted March 26, 2018 You can add a layerMask on the GUI and on the camera. Search the layerMask and GUI forum you will find information to help you. Maybe if you could reproduce a PG, it would be easier to help you Quote Link to comment Share on other sites More sharing options...
Wingnut Posted March 26, 2018 Share Posted March 26, 2018 https://www.babylonjs-playground.com/#UQ73E1#70 You can use that one... which I presented a few posts ago, @Dad72. I don't see how layerMask can work for this. Objective is... don't let highlights... show--thru red GUI panel. Currently, red gui is blocking the mesh (wanted), but not blocking the highlights. Wouldn't layerMask hide the actual mesh... from select cameras? Even IF the advancedDynamicTexture was 'forMesh' and placed on a plane, which was parented to camera, layerMask would not work (I don't think). Royi wants to see his mesh "thru" areas of the ADT where no controls are blocking view (like for mesh labels). The layerMask method... would simply not-camera-render all mesh "behind" the ADT-plane. Not workable for overlayed ADT (in-game GUI labels). Royi wants to see his scene mesh... in the areas where there are no GUI controls... me thinks. It might take some complicated modifications to the highlightLayer and glowLayer shaders... to accomplish this. They need to "respect" and "honor" GUI's .isForeground. Currently, I don't think either of them... care about ADT's isForeground AT ALL. Teenagers, you know. They have no respect for elders/alphas. Quote Link to comment Share on other sites More sharing options...
Guest Posted March 26, 2018 Share Posted March 26, 2018 You have an example here: https://www.babylonjs-playground.com/#Y3C0HQ#144 The UI is drawn on a second layer so it is not affected by the rendering pipeline It requires 2 cameras (one for the scene and one for the GUI): - line 10 to 13: I create the camera for the Ui and I set its layer mask - line 16: I set the layermask of my ADT to the same value and voila Quote Link to comment Share on other sites More sharing options...
Dad72 Posted March 26, 2018 Share Posted March 26, 2018 I took your example Wingnut and add the layerMask. We can now see that the problem is solved https://www.babylonjs-playground.com/#UQ73E1#71 Wingnut and BitOfGold 2 Quote Link to comment Share on other sites More sharing options...
Wingnut Posted March 26, 2018 Share Posted March 26, 2018 You're a God, @Dad72! Nice job! advancedTexture.layer.layerMask I need to memorize that. YAY! Quote Link to comment Share on other sites More sharing options...
royibernthal Posted March 27, 2018 Author Share Posted March 27, 2018 Interesting, I think I understand it Thanks One question though - are there any downsides to using multiple cameras? For instance does it affect performance or is it negligible? Also out of curiosity - Why can't a full screen ADT be set to render in front of HighlightLayer the same way a mesh can be rendered in front of a HighlightLayer - e.g. in the image I attached from WingNut's example where 2 spheres and their highlight are hidden behind the sphere that is closest to the camera. Quote Link to comment Share on other sites More sharing options...
Wingnut Posted March 27, 2018 Share Posted March 27, 2018 I agree. LayerMask is sort of a work-around for... something else that could/should be done. (imho). Quote Link to comment Share on other sites More sharing options...
Guest Posted March 27, 2018 Share Posted March 27, 2018 There is no penalty regarding performance as it is just a matter of ordering things The layerMask is designed to be use in this very specific case so no worry But anyway, you are right we should be able to render the ADT at the very end..I'll fix it royibernthal 1 Quote Link to comment Share on other sites More sharing options...
Wingnut Posted March 28, 2018 Share Posted March 28, 2018 Thx dk. Operating two scene.activeCameras... isn't a performance hit? (compared to a single camera) Anyway, thx for mod consids, DK! The foreground param and .isForeground prop... seems a bit confusing, to me. (nobody asked, Wingy) Maybe need .isAbsoluteForeground? http://doc.babylonjs.com/resources/transparency_and_how_meshes_are_rendered Maybe that needs a sister tutorial: How layers, sprites, particles, glows, highlights, godrays, and post/pipeline processes... are rendered/ordered (within/around alpha/non-alpha mesh, and atop/beneath/before/after each other). I have seen (repeated) forum questions regarding alpha/sorting... on most of those items. I know @Sebavan has gotten plenty of user questions about glows and highlights... regarding alpha. A see-it-happen PBT (playground-based tutorial) MIGHT remove some of the question-load, regarding these subjects. Probably not an easy topic to teach/learn. Lots of variables, I suppose. There's what... about 5 different locations to insert post-processes/effects... into the rendering pipeline? (Like I know anything about that stuff.) Layering. erf. I should just shut up, and do more studying, I think. Interesting topic, though. I learned stuff, and Royi and Dad72 might get Associate Producer credits for a new ADT feature! Alright! Wrapping up: Do Glow and Highlight have a .layer? I THINK Sebavan (I'm sure its Sebavan, but I get Luaacro and Sebavan confused sometimes, not sure why) once mentioned... that he thought he could (someday) make Glow and HighLight... be more alpha/sorting-wise. Perhaps we should team-up around him, and help him get that done, or do it for him. Thoughts? Might we need shader wizard NasimiAsl? How ARE the other post-p's (when dealing-with GUI)? Do godrays/lensFlare blast thru GUI panels/controls? Can an isForeground ADT... have particles IN-FRONT-OF its controls? oooh. Mesh sorting is ONE thing. Layers sorting... only Dad72 knows about that stuff. And don't confuse it with renderingGroups, kids. heh (Is Wingnut STILL yapping? Jeez, get a life, dude!) Quote Link to comment Share on other sites More sharing options...
Guest Posted March 28, 2018 Share Posted March 28, 2018 yes glow and highlight are layers They are now rendered before the ADT layer. Godrays and lens flare are postprocesses so they are also rendered before the ADT layer Wingnut 1 Quote Link to comment Share on other sites More sharing options...
royibernthal Posted March 30, 2018 Author Share Posted March 30, 2018 It works perfectly. Thanks DK GameMonetize and Wingnut 2 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.