MantisBT - Community
View Issue Details
0023474Community[OCCT] OCCT:Visualizationpublic2012-10-16 14:372013-12-19 13:59
Pawel 
bugmaster 
normalminor 
closedfixed 
WindowsVC++ 200832 bit
[OCCT] 6.5.4 
[OCCT] 6.7.0[OCCT] 6.7.0 
bugs vis(004) bug23474
0023474: Changing material/color/transparency of a shaded AIS_Shape requires 'Redisplay'
I've been testing the feature introduced in 23407 (Draw face outlines for XDE objects) and I spotted the following problem: When drawing face outlines of AIS_Shapes:

AIS_InteractiveContext::DefaultDrawer()->SetFaceBoundaryDraw(Standard_True)

The method AIS_Shape::SetMaterial(const Graphic3d_MaterialAspect& aMat) did not update the presentation for shaded presentation (in other words the material was not updated after setting it). I needed to call AIS_InteractiveContext::Redisplay on the corresponding object for the change to take effect.
Use MFC samples to reproduce.
- call AIS_InteractiveContext::DefaultDrawer()->SetFaceBoundaryDraw(Standard_True) after creating AIS_InteractiveContext
- Create a shape (e.g. sphere)
- Display it in shaded mode
- Change material

=======================
And a DRAW reproducer:
box b 10 20 30
vinit
vdisplay b
vfit
vsetdispmode b 1
vsetcolor b RED
vshowfaceboundary b 1
vsetcolor b BLUE

Further investigation revealed that within the body of AIS_Shape::SetMaterial the call (AIS_Shape.cxx, line 639)

if (aGroup->IsGroupPrimitivesAspectSet(Graphic3d_ASPECT_FILL_AREA))

returned false and so

aGroup->SetGroupPrimitivesAspect(anAreaAsp);

was not called.

Further, I realized that StdPrs_ShadedShapes.cxx, in method

static void ComputeFaceBoundaries

a new group is created but not all the aspects are copied and so the group behaves as if there were no aspect for 'Graphic3d_ASPECT_FILL_AREA'.
No tags attached.
related to 0023387closed bugmaster Community Visualization - transparency of specified material is ignored within AIS_Shape::SetMaterial() 
related to 0023519closed bugmaster Community Mixing wireframe and shaded visualization impacts performance 
png correct.png (34,860) 2013-11-04 16:44
https://tracker.dev.opencascade.org/
png faulty.png (28,502) 2013-11-04 16:44
https://tracker.dev.opencascade.org/
Issue History
2012-10-16 14:37PawelNew Issue
2012-10-16 14:37PawelAssigned To => Pawel
2012-10-16 14:40abvRelationship addedrelated to 0023407
2012-10-16 14:53PawelNote Added: 0021792
2012-10-16 14:53PawelAssigned ToPawel => bugmaster
2012-10-16 14:53PawelStatusnew => resolved
2012-10-16 14:55PawelNote Added: 0021793
2012-10-16 17:42PawelDescription Updatedbug_revision_view_page.php?rev_id=4354#r4354
2012-10-16 18:01abvAssigned Tobugmaster => san
2012-10-19 13:12PawelSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=4364#r4364
2012-10-23 12:00abvTarget Version6.5.4 => 6.6.0
2012-10-24 11:12sanNote Added: 0021915
2012-10-27 03:46sanRelationship addedrelated to 0023387
2012-11-07 15:40PawelRelationship addedrelated to 0023519
2013-02-26 18:31sanTarget Version6.6.0 => 6.7.0
2013-10-01 14:26PawelNote Added: 0025819
2013-10-01 14:26PawelStatusresolved => feedback
2013-11-01 19:34sanAssigned Tosan => kgv
2013-11-01 19:34sanNote Added: 0026427
2013-11-04 14:49kgvNote Added: 0026438
2013-11-04 14:49kgvAssigned Tokgv => bugmaster
2013-11-04 14:49kgvStatusfeedback => reviewed
2013-11-04 14:50kgvNote Edited: 0026438bug_revision_view_page.php?bugnote_id=26438#r6171
2013-11-04 16:44PawelFile Added: correct.png
2013-11-04 16:44PawelFile Added: faulty.png
2013-11-04 16:48PawelNote Added: 0026439
2013-11-06 13:52mkvNote Added: 0026473
2013-11-06 13:53mkvTest case number => bugs vis(004) bug23474
2013-11-06 13:53mkvAssigned Tobugmaster => mkv
2013-11-11 15:14mkvNote Added: 0026540
2013-11-11 15:14mkvAssigned Tomkv => bugmaster
2013-11-11 15:14mkvStatusreviewed => tested
2013-11-15 10:24bugmasterChangeset attached => occt master 7893b2fa
2013-11-15 10:24bugmasterStatustested => verified
2013-11-15 10:24bugmasterResolutionopen => fixed
2013-12-19 13:51bugmasterStatusverified => closed
2013-12-19 13:59bugmasterFixed in Version => 6.7.0

Notes
(0021792)
Pawel   
2012-10-16 14:53   
Branch CR23474 has been pushed.

As a solution I have obtained a reference to the existing Graphic3d_Group instead of creating a new one. That solved the problem. However, maybe it is better/necessary (my understanding for the Visualization module is unfortunately limited) to create a new group. In that case all the aspect information (Graphic3d_AspectLine3d, Graphic3d_AspectFillArea3d, Graphic3d_AspectText3d etc.) should be copied to the new group, I guess.

Please review.
(0021793)
Pawel   
2012-10-16 14:55   
Dear bugmaster, please add relation to the issue 0023407.
(0021915)
san   
2012-10-24 11:12   
We need some time to analyze the proposed solution. The point is that AIS_Shape::Compute() creates several Graphic3d_Group instances while the patch modifies the aspect of one of the groups only, so some side effects are possible.
(0025819)
Pawel   
2013-10-01 14:26   
Dear Sergey,

can you please consider incorporating/verifying this patch for the upcoming 6.7.0 release? I've been using it for a year now and haven't been able to spot any resulting problems.

Thanks
(0026427)
san   
2013-11-01 19:34   
Dear kgv,

Can you please review the patch and send it to testing if it is OK?
(0026438)
kgv   
2013-11-04 14:49   
(edited on: 2013-11-04 14:50)
I have no objections against the patch - re-using of the group looks reasonable in this case. Although I am unable to check original problem due to missing reference snapshots.

Patch has been re-based and pushed to branch CR23474_1.
Ready for testing.

(0026439)
Pawel   
2013-11-04 16:48   
I have attached two snaphots illustrating how the test DRAW script works like with (correct.png) and without (faulty.png) the proposed patch.

In the current implementation the line:

vsetcolor b BLUE

has no effect and the box remains red. After the patch is applied the box changes color (it's not really blue because of the material properties).
(0026473)
mkv   
2013-11-06 13:52   
Dear BugMaster,

Branch CR23474_1 (and products from GIT master) was compiled on Linux and Windows platforms and tested.
SHA-1: ebd78273ddeca84e68f18765c1d3196f98639ac8

Number of compiler warnings:

occt component :
Linux: 320 (323 on master)
Windows: 0 (0 on master)

products component :
Linux: 188 (189 on master)
Windows: 287 (287 on master)

Regressions/Differences:
No regressions/differences

Testing cases:
http://occt-tests/CR23474-1-master-occt/Debian60-64/bugs/vis/bug23474.html [^]
http://occt-tests/CR23474-1-master-occt/Windows-32-VC9/bugs/vis/bug23474.html [^]
bugs vis(004) bug23474: OK

Testing on Linux:
Total MEMORY difference: 355397792 / 356295124
Total CPU difference: 42998.710000000625 / 40672.21000000072

Testing on Windows:
Total MEMORY difference: 410980760 / 406471844
Total CPU difference: 29134.109375 / 34772.53125

There are not differences in images found by testdiff.
(0026540)
mkv   
2013-11-11 15:14   
Dear BugMaster,

Branch CR23474_1 was rebased on current master. Branch CR23474_1 (and products from GIT master) was compiled on Linux and Windows platforms and tested.
SHA-1: 83e5dabfb0e3698209d4a5001fb886075210017b

Number of compiler warnings:

occt component :
Linux: 318 (318 on master)
Windows: 0 (0 on master)

products component :
Linux: 188 (188 on master)
Windows: 287 (287 on master)

Regressions/Differences:
No regressions/differences

Testing cases:
http://occt-tests/CR23474-01-master-occt/Debian60-64/bugs/vis/bug23474.html [^]
http://occt-tests/CR23474-01-master-occt/Windows-32-VC9/bugs/vis/bug23474.html [^]
bugs vis(004) bug23474: OK

Testing on Linux:
Total MEMORY difference: 356189692 / 356528316
Total CPU difference: 42744.18000000111 / 42450.47000000157

Testing on Windows:


There are not differences in images found by testdiff.