How to fix text rendering above 3D patch?

11 views (last 30 days)
Chris
Chris on 10 Nov 2015
Edited: Chris on 5 Jan 2016
I have a fairly complex GUI for the manipulation of 3D models which have experimental data interpolated onto their surfaces from a discrete set of experimental data. I need to label the locations at which the experimental data is measured. I do this by doing a plot3(...) of the data point locations, and then a text(...) of the label of interest at each point.
My problem however is that the text does not render correctly on top of the 3D geometry. It is almost good, except that the text is half clipped or fully clipped by the 3D geometry depending on camera angle. I haven't found a solution to this online. People suggest uistack and other methods but none of those work in this case. Moving the data points above the patch geometry is also not an option, because the geometry is highly complex and this cannot be generalised.
Does anybody know of some kind of low level OpenGL tweak I can use in Matlab to force the text to be rendered closer to the front of the screen than any patch object that it is deemed to coincide with? I do not particularly want to use annotate() since it uses figure coordinates which will cause a lot of headaches downstream in the GUI.
Thanks

Accepted Answer

Chris
Chris on 5 Jan 2016
Edited: Chris on 5 Jan 2016
The answer to this came to me a few months ago out of the blue after much frustration. Just posting here so that anyone else can see. I have tried everything to fiddle with OpenGL drivers, uistack, and other workarounds. Nothing worked.
I simply decided to calculate the patch normal that was under the text, then actually plot the text at the end of the normal, with some appropriate multiplier so that the text is just above the patch in 3D space. This involves finding the relevant patch face and its normal, but that is not too complex.

More Answers (0)

Categories

Find more on Graphics Performance in Help Center and File Exchange

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!