View Issue Details

IDProjectCategoryView StatusLast Update
0023387CommunityOCCT:Visualizationpublic2015-06-29 15:57
ReporterJerome Monaco Assigned Tobugmaster  
PrioritynormalSeverityminor 
Status closedResolutionfixed 
PlatformWindowsOSVC++ 2010 
Product Version6.5.3 
Target Version6.9.0Fixed in Version6.9.0 
Summary0023387: Visualization - transparency of specified material is ignored within AIS_Shape::SetMaterial()
DescriptionWhen using AIS_Shape::SetMaterial the transparency is not updated with the transparency of the material and finally the tranparency is not updated.

The corrected code is below : AIS_Shape.cxx line 724

//=======================================================================
//function : SetMaterial
//purpose :
//=======================================================================

void AIS_Shape::SetMaterial(const Graphic3d_MaterialAspect& aMat)
{
  if( !HasColor() && !IsTransparent() && !HasMaterial() ) {
    myDrawer->SetShadingAspect(new Prs3d_ShadingAspect());
  }
  hasOwnMaterial = Standard_True;

  myDrawer->ShadingAspect()->SetMaterial(aMat,myCurrentFacingModel);
  /// OLD CODE : myDrawer->ShadingAspect()->SetTransparency(myTransparency,myCurrentFacingModel);

  myDrawer->ShadingAspect()->SetTransparency(aMat.Transparency(),myCurrentFacingModel);

  if(!GetContext().IsNull()){
    if(GetContext()->MainPrsMgr()->HasPresentation(this,1)){
      Handle(Prs3d_Presentation) aPresentation =
        GetContext()->MainPrsMgr()->CastPresentation(this,1)->Presentation();
      Handle(Graphic3d_Group) aGroup = Prs3d_Root::CurrentGroup(aPresentation);
    
      Handle(Graphic3d_AspectFillArea3d) anAreaAsp = myDrawer->ShadingAspect()->Aspect();
      aPresentation->SetPrimitivesAspect(anAreaAsp);
      // Check if aspect of given type is set for the group,
      // because setting aspect for group with no already set aspect
      // can lead to loss of presentation data
      if (aGroup->IsGroupPrimitivesAspectSet(Graphic3d_ASPECT_FILL_AREA))
        aGroup->SetGroupPrimitivesAspect(anAreaAsp);
    }
    myRecomputeEveryPrs =Standard_False; // no mode to recalculate :only viewer update
    myToRecomputeModes.Clear();
  }
}
Steps To ReproduceHandle(AIS_InteractiveContext) ais = ...

BRepPrimAPI_MakeBox MB( 100.0, 100.0, 100.0 );
TopoDS_Shape s = MB.Solid();

Handle( AIS_Shape ) aShape = new AIS_Shape( s );

Graphic3d_MaterialAspect aMat( Graphic3d_NameOfMaterial::Graphic3d_NOM_BRASS );
aMat.SetTransparency( 0.75 );

aShape->SetMaterial( aMat );
ais->Display( aShape, Standard_True );

pload MODELING VISUALIZATION
box b 1 2 3
vinit View1
vclear
vsetdispmode 1
vdisplay b
vfit
vsetmaterial b water
TagsNo tags attached.
Test case number

Relationships

related to 0024864 closedapn Open CASCADE Visualization - Implementing refractions in ray-tracing 
related to 0025511 closedbugmaster Open CASCADE Visualization - drop redundant viewer option V3d_View::Transparency() 
related to 0023474 closedbugmaster Community Changing material/color/transparency of a shaded AIS_Shape requires 'Redisplay' 
related to 0024855 closedapn Open CASCADE Revision of parameters of standard materials 
related to 0025459 closedbugmaster Open CASCADE Visualization - AIS_ColoredShape::SetMaterial() should not reset custom colors 

Activities

kgv

2014-02-17 15:17

developer   ~0027923

Existing behavior might looks unnatural to some degree.
However proposed solution contradicts to current design of Interactive Object and might break existing code.

Thus it doesn't make sense until AIS re-design.

san

2014-04-25 14:59

developer   ~0029075

Last edited: 2014-04-25 15:04

This issue becomes more critical after implementation of transparent materials and refraction support - see 0024864.

kgv

2014-11-27 15:44

developer   ~0034753

Last edited: 2014-11-27 16:04

The behavior of AIS_Shape::SetMaterial() has been improved within 0025459 - now
transparency of specified material is overridden only when AIS_Shape::SetTransparency() called before or afterwards (should be discarded by AIS_Shape::UnsetTransparency()).

So the main issue described in the bug should be solved now.
However the consistency of all there flags and methods to be further checked.

kgv

2015-06-29 15:30

developer   ~0042555

Dear bugmaster,

please close the bug as fixed within 0025459.

Issue History

Date Modified Username Field Change
2012-08-17 11:03 Jerome Monaco New Issue
2012-08-17 11:03 Jerome Monaco Assigned To => san
2012-08-30 19:49 abv Status new => assigned
2012-10-23 12:05 abv Target Version => 6.6.0
2012-10-23 12:05 abv Steps to Reproduce Updated
2012-10-27 03:46 san Relationship added related to 0023474
2013-02-26 18:32 san Target Version 6.6.0 => 6.7.0
2013-12-12 11:07 san Target Version 6.7.0 => 6.7.1
2014-02-17 15:17 kgv Note Added: 0027923
2014-02-17 15:17 kgv Priority normal => low
2014-02-17 15:17 kgv Target Version 6.7.1 => 7.0.0
2014-04-25 14:23 kgv Relationship added related to 0024855
2014-04-25 14:46 kgv Steps to Reproduce Updated
2014-04-25 14:56 san Assigned To san => dbp
2014-04-25 14:59 san Note Added: 0029075
2014-04-25 14:59 san Priority low => normal
2014-04-25 14:59 san Target Version 7.0.0 => 6.8.0
2014-04-25 15:04 san Relationship added related to 0024864
2014-04-25 15:04 san Note Edited: 0029075
2014-10-17 08:47 kgv Target Version 6.8.0 => 7.1.0
2014-11-19 19:38 kgv Relationship added related to 0025459
2014-11-27 15:44 kgv Note Added: 0034753
2014-11-27 15:46 kgv Summary Transparency is not set thru SetMaterial aspect in AIS_Shape => Visualization - transparency of specified material is ignored within AIS_Shape::SetMaterial()
2014-11-27 15:48 kgv Relationship added related to 0025511
2014-11-27 16:04 kgv Note Edited: 0034753
2015-06-29 15:30 kgv Note Added: 0042555
2015-06-29 15:30 kgv Assigned To dbp => bugmaster
2015-06-29 15:30 kgv Status assigned => feedback
2015-06-29 15:30 kgv Resolution open => fixed
2015-06-29 15:30 kgv Fixed in Version => 6.9.0
2015-06-29 15:30 kgv Target Version 7.1.0 => 6.9.0
2015-06-29 15:57 abv Status feedback => closed