Jump to content

Transparent plane that hide meshes under


c75
 Share

Recommended Posts

Hi guys, is it real to do something like on picture?

I want a plane in the scene that would hide meshes under it, but it must be transparent. So I should see scene background or another layers via this plane

 

scene1.png

Link to comment
Share on other sites

Hiya c75.  I know ONE way to do it.  But the plane won't be transparent... it will only LOOK that way.  ;)

What if... we placed another camera... on the bottom of that plane, and that camera would render ONLY backgrounds/skyboxes and ground, but not any other mesh?

Then what if we made THAT camera's 'view'.... be the texture on that plane?  The plane would be like a TV screeen... that views the image from the camera attached to the back/bottom  (which only renders mesh YOU CHOOSE to render).

That might work, huh?

http://www.babylonjs-playground.com/#1WROZH#12

In that demo, there are 4 renderTargetTextures (RTT's)... gotten from 4 different cameras... textured onto 4 planes... that are parented to camera 1's screen bottom.

The FIRST plane (leftmost) (mon1) IS the view from camera 1.  But WHY does it not show in its RTT view (mon1 view)... the 4 planes parented onto it?

Because of layerMasks.  All 4 monitors and their background panel... are set layerMask 1.  All 4 cameras are set layerMask 2.  Cool, huh?

Also notice that each RTT has a .renderList, too.  So, if you can't set certain meshes to be invisible (in the RTT's view) with layerMask settings, then you can also use the .renderList settings to get the job done.

I'll let you "run with it" from here.  I think you can now see the possibilities (and power) of layerMasks and RTT's.

One thing you should know.  RTT's won't render "post-processing" effects, because the RTT's are gotten "upstream" (before post-processing).  SO, things like edgesRenderer and highlightLayer... won't be rendered in a RTT.  You can see this in the demo.  Camera 1 MAIN VIEW on the canvas... is rendering those red edgesRenderings.  Camera 1 view in mon 1... shows no red edges.  It is upstream of the system that makes those red lines.  Sorry about that... but that's just the way RTT's work.

Hope this helps.  It is not exactly what you wanted, but it IS kind of cool, huh?  It should be able to fake it.  :)  Others may have better ideas.

We can talk more about this, if you like.  I enjoy talking with you, C75, so it would be my pleasure.  But you are kind of a genius, and I'm not, so... be gentle with me, okay?  Don't use too many fancy words or fancy tech... I'll get lost.  Keep in mind that I am like a puppy... driving a Cray supercomputer, when I use BJS.  :D

PS:  Credit to @Deltakosh for fixing that demo with layerMasks FOR ME.  Without them/him... we DO see the 4 monitor planes in mon 1 view.  And the mon1 inside-of mon1... is black.  With the layerMasks... all is good.  Thanks DK!  :)

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