Jump to content

HighlightLayer is in front of GUI


royibernthal
 Share

Recommended Posts

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.)   :)

Link to comment
Share on other sites

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.  :)

Link to comment
Share on other sites

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 ;)

Link to comment
Share on other sites

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.

ss.png

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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!)

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...