DiscussionsIssue archiveOCCT:Visualization

Archived issue #0029366

Visualization, OpenGl_Text - artifacts when using Aspect_TODT_SHADOW/Aspect_TODT_DEKALE at different zoom level

Open CASCADEOCCT:Visualizationclosed8 public notes

Search issues

Description

Artifacts occur when using Aspect_TODT_SHADOW or Aspect_TODT_DEKALE at different zoom levels - the shadow/decal changes its position.

The reason is the fixed Z shift 0.00001f specified in world coordinate system, intended to ensure that decal/shadow will be drawn behind text (avoid Z-fighting):
    case Aspect_TODT_DEKALE:
    {
      theCtx->SetColor4fv (theColorSubs);
      setupMatrix (theCtx, theTextAspect, OpenGl_Vec3 (+1.0f, +1.0f, 0.00001f));
      drawText    (theCtx, theTextAspect);
      setupMatrix (theCtx, theTextAspect, OpenGl_Vec3 (-1.0f, -1.0f, 0.00001f));
      drawText    (theCtx, theTextAspect);
      setupMatrix (theCtx, theTextAspect, OpenGl_Vec3 (-1.0f, +1.0f, 0.00001f));
      drawText    (theCtx, theTextAspect);
      setupMatrix (theCtx, theTextAspect, OpenGl_Vec3 (+1.0f, -1.0f, 0.00001f));
      drawText    (theCtx, theTextAspect);
      break;
    }
    case Aspect_TODT_SHADOW:
    {
      theCtx->SetColor4fv (theColorSubs);
      setupMatrix (theCtx, theTextAspect, OpenGl_Vec3 (+1.0f, -1.0f, 0.00001f));
      drawText    (theCtx, theTextAspect);
      break;
    }

Steps to reproduce

N/A

pload MODELING VISUALIZATION
box b 1 2 3
vclear
vinit View1
vsetdispmode 1
vdisplay b
vcamera -persp
vfit
vdrawtext t "Text"  -2d -persPos -1 1 -subColor BLUE1 -pos 0 -100 0 -color 0 1 1 -height 20 -font Times -dispType decal
vzoom 2
vzoom 2

Public activity

8 archived notes

Participants are labeled by their role within this record.

01Commenter 2
Branch [archived branch] has been created by Author.

[revision removed]


Detailed log of new commits:

Author: Author
Date: Mon Dec 4 16:29:43 2017 +0300

    0029366: Visualization, OpenGl_Text - artifacts when using Aspect_TODT_SHADOW/Aspect_TODT_DEKALE at different zoom level
    
    OpenGl_Text now applies Polygon Offset instead of Z-shift in world coordinates for drawing background.
    OpenGl_Context::SetPolygonOffset() - polygon offset state has been moved from OpenGl_Workspace to OpenGl_Context.
02Commenter 2
Branch [archived branch] has been created by Author.

[revision removed]


Detailed log of new commits:

Author: Author
Date: Mon Dec 4 16:29:43 2017 +0300

    0029366: Visualization, OpenGl_Text - artifacts when using Aspect_TODT_SHADOW/Aspect_TODT_DEKALE at different zoom level
    
    OpenGl_Text now applies Polygon Offset instead of Z-shift in world coordinates for drawing background.
    OpenGl_Context::SetPolygonOffset() - polygon offset state has been moved from OpenGl_Workspace to OpenGl_Context.
03Author
Patch is ready for review.
http://jenkins-test-10.nnov.opencascade.com/view/CR29366_1-master-KGV

Note that using Polygon Offset impacts text rendering performance negatively (in case of affected text styles), which is expected due to extra OpenGL calls.

04Commenter 2
Branch [archived branch] has been updated forcibly by Author.

[revision removed]
05Commenter 5
Branch CR29366_1 reviewed without remarks, ready for testing.
06Commenter 1
Combination -
OCCT branch : [archived branch] SHA - [revision removed]
Products branch : [archived branch] SHA - [revision removed]
was compiled on Linux, MacOS and Windows platforms and tested on optimize mode.

Number of compiler warnings:
No new/fixed warnings

Regressions/Differences/Improvements:
No regressions/differences

CPU differences:
Debian70-64:
OCCT
Total CPU difference: 18374.739999999685 / 18469.379999999688 [-0.51%]
Products
Total CPU difference: 7467.210000000008 / 7457.550000000003 [+0.13%]
Windows-64-VC10:
OCCT
Total CPU difference: 17961.26873559861 / 17828.96428749855 [+0.74%]
Products
Total CPU difference: 8014.161372499974 / 8009.6685436999705 [+0.06%]


Image differences :
No differences that require special attention

Memory differences :
No differences that require special attention
07Commenter 2
Branch [archived branch] has been deleted by Author.

[revision removed]
08Commenter 2
Branch [archived branch] has been deleted by Author.

[revision removed]

Related records