MantisBT - Open CASCADE
View Issue Details
0025914Open CASCADE[OCCT] OCCT:Visualizationpublic2015-03-11 16:442020-09-21 17:16
[OCCT] 6.8.0 
[OCCT] 7.6.0* 
0025914: Visualization, MeshVS - text labels are drawn behind the object
When the MeshVS_Mesh is shown in the shading mode with text (MeshVS_DMF_TextDataPrs | MeshVS_DMF_Shading) all text labels are rendered as if they are always behind the shaded mesh elements.

It looks like incorrect depth values are written for text labels, or depth buffer is cleared between the text rendering and the shaded mesh rendering.
1. To reproduce In DRAW:

pload ALL
meshfromstl s data/stl/sh1.stl
meshtext s
vsetdispmode s 34

2. Scenario that works well (MeshVS not used!):

pload ALL
box b 1 2 3
# Display the text first to follow the same sequence as in MeshVS_Mesh
vdrawtext "sample text" 2 -1 2 255 0 0 0 0 0 0 40 1
vsetdispmode 1
vdisplay b

No tags attached.
png bad_mesh_text.png (38,696) 2015-03-11 19:39
png good_text.png (4,513) 2015-03-11 19:51
Issue History
2015-03-11 16:44aslNew Issue
2015-03-11 16:44aslAssigned To => kgv
2015-03-11 16:55abvNote Added: 0038276
2015-03-11 17:08sanSummaryRegression in the text rendering on mesh (MeshVS) => Visualization, MeshVS - Regression in the text data rendering on mesh
2015-03-11 17:08sanDescription Updatedbug_revision_view_page.php?rev_id=9578#r9578
2015-03-11 17:08sanSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=9580#r9580
2015-03-11 19:38sanNote Added: 0038286
2015-03-11 19:39sanFile Added: bad_mesh_text.png
2015-03-11 19:39sanNote Edited: 0038286bug_revision_view_page.php?bugnote_id=38286#r9582
2015-03-11 19:49sanSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=9583#r9583
2015-03-11 19:51sanFile Added: good_text.png
2015-03-11 19:52sanNote Added: 0038287
2015-03-11 19:53sanAssigned Tokgv => asl
2015-03-11 19:53sanStatusnew => assigned
2015-03-11 22:45abvNote Added: 0038289
2015-03-12 10:38sanNote Added: 0038290
2015-04-17 19:08aplNote Added: 0040002
2015-04-17 19:09aplNote Edited: 0040002bug_revision_view_page.php?bugnote_id=40002#r10092
2015-04-17 19:18abvRelationship addedrelated to 0002935
2015-04-27 19:25kgvTarget Version6.9.0 => 7.1.0
2016-10-13 12:52kgvSeveritymajor => minor
2016-10-13 12:52kgvProduct Version => 6.8.0
2016-10-13 12:52kgvSummaryVisualization, MeshVS - Regression in the text data rendering on mesh => Visualization, MeshVS - text labels are drawn behind the object
2016-10-25 09:24kgvTarget Version7.1.0 => 7.2.0
2017-07-20 10:46kgvTarget Version7.2.0 => 7.4.0
2019-01-21 11:50kgvRelationship addedrelated to 0027920
2019-08-13 12:04kgvTarget Version7.4.0 => 7.5.0
2020-09-21 17:16kgvTarget Version7.5.0 => 7.6.0*

2015-03-11 16:55   
Alexander, do you reproduce this problem on current master or older version?
2015-03-11 19:38   
(edited on: 2015-03-11 19:39)
Just checked: reproduced with the current master (vc10 32-bits optimized build), see bad_mesh_text.png attached.

2015-03-11 19:52   
NOT reproduced without MeshVS - see good_text.png attached.
So it looks like pure MeshVS issue not related to text rendering in general...
2015-03-11 22:45   
I guess this might be due to different display priorities, recalling that something like that has been made as work-around against 0025732 (if I am not mistaken)
2015-03-12 10:38   
Display priorities do not affect the results of depth test in case if the primitives do not coincide geometrically. And after all, text rendering in general works as expected, the problem is located most likely somewhere at MeshVS level.
2015-04-17 19:08   
(edited on: 2015-04-17 19:09)
The text primitives have Aspect_TOST_ANNOTATION. It means that the depth test and depth writing are turned off. The text primitives will be overlapped by shaded faces, which follow them in rendering pipeline.

The order of text and face primitives is defined by MeshVS_Mesh::Compute(). This method executes primitive builders in accordance with their priority declared in "MeshVS_BuilderPriority.hxx".

For today, there are two possible options:
- Change priority of text builder. In this case the text elements will appear in front of the mesh, regardless of whether they are on the back side or in front of the mesh.
- Use another aspect Aspect_TOST_NORMAL for text. In this case the back side labels will be hidden. However, the labels located on the front might graphically intersect with the mesh.

It was decided to implement the 2nd option.