Drawing 2D Lines with 3D Occlusion
I'm trying to achieve the effect of visualizing a satellite orbit with a constant thickness no matter the viewing distance, so 3D lines with DrawDebugLine() aren't an option.
Here's the desired effect:
I’ve only come up with this:
However there are a few problems with this approach:
When the scene gets a bit more complex, there could be visual glitches every where, not to mention the performance. There is some optimization work can be done to minimize the problems, like skipping points based on viewing distance and dealing with every corner case, but I'm not sure if it's even worth the effort.
So I’m looking for a better approach to achieve the same effect. Any thoughts?
With the help of engine source FSplineComponentVisualizer::DrawVisualization and some forum posts, this is what I end up with:
Basically what I did was extending UPrimitiveComponent class and override these two functions:
Define your own component bounds to deal with frustum culling with
Then create another class inheriting from
If you want your line occluded by other objects, the
With a thickness of
Follow this question
Once you sign in you will be able to subscribe for any updates here