<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Tue, Oct 13, 2015 at 1:12 PM, -Daniel- <span dir="ltr"><<a href="mailto:ich_daniel@habmalnefrage.de" target="_blank">ich_daniel@habmalnefrage.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Hi there,<br>
<br>
I have a cube with text on every corner. For this I use vtkCaptionActor2D,<br>
so that the text is always visible in the foreground. Now I want to hide the<br>
text (or vtkCaptionActor2D) when the corresponding corner can't be seen in<br>
the renderer.<br>
<br>
How can I hide a vtkCaptionActor2D?<br></blockquote><div><br></div><div>As far as I'm aware, there is not a built-in way to do this, and it will take some work from the application side.</div><div><br></div><div>The vtkCaptionActor2D (or any actor for that matter) can be hidden by calling SetVisibility(0) on the actor. The trick is going to be detecting when the point is not visible.</div><div><br></div><div>The vtkSelectVisiblePoints class does something similar to what you want. In that class's IsPointOccluded method, a point is transformed using the active camera's modelview/projection matrices. The transformed point is tested to see if it falls within a rectangular region (they use some selection bounds, but it could just be the viewport extents in your case), and then it also compares the point to the renderer's depth buffer to see if there's anything in front of it.</div><div><br></div><div>SeeĀ <a href="https://github.com/Kitware/VTK/blob/master/Rendering/Core/vtkSelectVisiblePoints.cxx#L241">https://github.com/Kitware/VTK/blob/master/Rendering/Core/vtkSelectVisiblePoints.cxx#L241</a> for the implementation.</div><div><br></div><div>You'll need to do something similar for your usecase, and update the actor's visibility based on whether the point is occluded.</div><div><br></div><div>Hope this helps,</div><div>Dave</div></div></div></div>