fsmorygo Posted September 24, 2018 Share Posted September 24, 2018 The title says it all. I have a room with PBR walls\floor\ceiling. I have a mirror on the wall and I want to make some object inside the room invisible unless you look at it through a mirror. How can I make this work using BJS? Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted September 24, 2018 Share Posted September 24, 2018 Perhaps you could use a beforerender , as long a person cannot see the mirror and the mesh at the same time (highly likely, since angle of incidence == angle of reflection). You should probably use a scene level beforeRender, because it ALWAYS runs. Mesh level only run when mesh is going to render. The beforerender might test if the mirror is inFrustum set the visibility to 0 else 1. Quote Link to comment Share on other sites More sharing options...
fsmorygo Posted September 24, 2018 Author Share Posted September 24, 2018 @JCPalmer this won't work unfortunately as the object may still be in the viewport. Imagine you looking in the mirror while holding an apple in your hands. I want the apple to be seen in the mirror but not directly. Quote Link to comment Share on other sites More sharing options...
brianzinn Posted September 25, 2018 Share Posted September 25, 2018 Here's one way using observables: https://www.babylonjs-playground.com/#12MKMN#3 Another way is to set MirrorTexture activeCamera and use a layer mask. edit: And welcome to the forum!! ? Quote Link to comment Share on other sites More sharing options...
fsmorygo Posted October 15, 2018 Author Share Posted October 15, 2018 @brianzinn thx a lot. Solved that using layer masks. Quote Link to comment Share on other sites More sharing options...
Guest Posted October 15, 2018 Share Posted October 15, 2018 Flagging as solved 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.