DiscussionsIssue archiveOCCT:Visualization

Archived issue #0025914

Visualization, MeshVS - text labels are drawn behind the object

Open CASCADEOCCT:Visualizationclosed7 public notes

Search issues

Description

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.

Steps to reproduce

1. To reproduce In DRAW:
pload ALL
vinit
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
vinit
# 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
vfit

Public activity

7 archived notes

Participants are labeled by their role within this record.

01Commenter 1
Alexander, do you reproduce this problem on current master or older version?
02Commenter 2
Just checked: reproduced with the current master (vc10 32-bits optimized build), see Attachment 1 (PNG) attached.

03Commenter 3
NOT reproduced without MeshVS - see Attachment 2 (PNG) attached.
So it looks like pure MeshVS issue not related to text rendering in general...
04Commenter 4
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)
05Commenter 5
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.
06Commenter 6
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.

07Commenter 2
To be considered on real need.
Lets close for now as non-blocking.