I have quite a number of GH components that render geometry (text, curves, meshes, etc) to fixed viewport coordinates to create a sort of “heads-up display.” These have always worked okay-but-not-great - the strategy I employ has some drawbacks. What I’m doing generally is to use some of the methods on RhinoViewport like GetWorldToScreenScale and GetFrustum(near/far)Plane in order to figure out where to draw. I am typically picking some depth parameter along the frustum and positioning a screen-parallel plane there, and using ClientToWorld/WorldToClient to convert coordinates.
Some of the limitations of this approach:
Depending on what “depth” parameter is chosen, it is hard to control whether the geometry I draw goes “behind” real scene objects. I have tried Push/Pop Depth Testing, Enable/Disable Depth Writing, setting the DepthMode, etc, but have never been successful - perhaps I am just not understanding.
I also struggle with clipping issues. I can manipulate the component’s clipping box, but this is unfortunately designed for use with world-oriented geometry and not calculated on a per-viewport basis. Because the geometry I’m drawing may be very far from the origin (and the scene) it seems like a mistake to add it to the scene bounding box. is there anything else I can do to prevent clipping, or a better strategy for working with the component’s ClippingBox?
With these components in use, right-click orbit behavior in the viewport behaves unexpectedly (setting the center of the orbit far away from what one would expect, requiring a constant “recentering” with zoom-selected or some other method.) Is there a way to exclude certain drawn geometry from this calculation?
Would greatly appreciate any guidance DisplayPipeline gurus have for me!