thomasc Posted August 7, 2016 Share Posted August 7, 2016 Hello, Group2D on a canvas is really a powerfull tool to add labels / tooltips on 3D object But apparently Group2D are being displayed even when the mesh is off-screen or, more precisely, behind the camera. This playground shows this beahiour (it is the tracking boxes demo with the camera radius set so that the camera is positionned in the middle of the boxes) : http://babylonjs-playground.com/#1N9RJY#34 As you can see labels are displayed for boxes located behind the camera as well. Is there a way to hide them easily ? I imagine that Group2D is projecting the central point on the tracked mesh on the screen, without checking if the mesh is in front or behind the screen plane. Thanks Quote Link to comment Share on other sites More sharing options...
Wingnut Posted August 10, 2016 Share Posted August 10, 2016 Hiya @thomasc No responses yet, eh? I've heard that chief canvas2D author @Nockawa is short on time, at the moment. And there are MANY issues with the Canvas2D system... yet to be tweaked and hammered-out. This issue is one such. But in defense of Nockawa... the Canvas2D system is VAST (big). It needs to be that way, because of what it is and what it does. And, it is newly installed in BJS... so there's going to be issues. I hope you can be patient. I put-in a couple hours today... trying to find a temporary work-around: http://babylonjs-playground.com/#1N9RJY#39 I failed... but... allow me to tell you where I'm at. The objective... was to build an in-renderloop "is mesh out of camera frustum" checker, and if so, "disable" the label. (dis-label?) I also tested mesh.setEnabled(false)... a somewhat related topic. Notice that the playground begins with Box #5 and Box #14 mesh'n'label'... in front of the camera. Those are the two mesh I set disabled in lines 59 & 60. Box #14 is behind the camera, but not rendered. Box #5 is in front of camera, but not rendered. Both labels are still active. Lines 44 to 57 are my meshWatcher, currently watching for Box #14 to enter/leave camera frustum (camera view). If you open console and watch, then pan the camera around, you will see the un-rendered Box #14 enter/leave frustum. My meshWatcher seems to be working. Now look at lines 61-86. This is a nightmare of attempts to make Box #5 label (group or rectangle)... go invisible, temporarily. What a mess, eh? Incompetence just POURING out of me, there. heh You know what I was going to try. Essentially, continually check and do label maintentance... inside the renderLoop... only labeling mesh that were in-view. Boy, is it difficult to temporarily hide a label. Oh my gosh! Eventually, I lost gumption, cried a little, and then watched a movie called Wreck-It Ralph. But... I figged I would show you my mess... let you run with it, if you felt like doing that. Canvas2D is SUCH a different system than what we are familiar-with. It has a perfectly good z-ordering system within it's own primitives, but it is not an easy thing to include "among" the mesh z-ordering. It is not like any standard BJS mesh, that's for sure. So, it is unusual and will take some time for us to learn its tricks and secrets. As you can tell, many of us needed this system RIGHT NOW, and its popularity went crazy! But, it is... umm.... detailed... and Nockawa just finished coding/installing this beauty. I fear he might be overwhelmed by the amount of people... wanting to know all those tricks and secrets. He foresaw this possibility, and wrote an immense documentation package for the system. But even all those docs... barely scratches the surface of how it all works, and the big-picture thoughts behind it all. If you push the debug layer button, and choose the clickable labels choice, you will see that the standard debug-layer labels... don't have this issue. Box 14 and 5 have no labels (proper)... and no labels are bleeding through from out-of-view mesh. SO, we KNOW it CAN work correctly. Hopefully, Nockawa will come save the day, if possible. If not, maybe you, I, or another... can get my de-labeler work-around happening. We'll talk more. (oh no, eh?) 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.