ViewCube is changing according to light even if Graphic3d_TypeOfShadingModel_Unlit is set

Hi gentlemen, I have a display in 3D view with ViewCube.
I do not understand why my ViewCube react to light activation/desactivation even with its ShadingModel is set to UNLIT.
I tried to
- redisplay it after light change
- modify its Aspect and material but I did not find any solution

I am certainly missing something or doing something wrong.
I would appreciate any advice !

Best regards.

gkv311 n's picture

even with its ShadingModel is set to UNLIT.

 How exactly you change shading aspects of ViewCube? As it is not unlit by default:

192 void AIS_ViewCube::setDefaultAttributes()
 193 {
 194   myDrawer->TextAspect()->SetHorizontalJustification(Graphic3d_HTA_CENTER);
 195   myDrawer->TextAspect()->SetVerticalJustification  (Graphic3d_VTA_CENTER);
 196   myDrawer->TextAspect()->SetColor (Quantity_NOC_BLACK);
 197   myDrawer->TextAspect()->SetFont (Font_NOF_SANS_SERIF);
 198   myDrawer->TextAspect()->SetHeight (16.0);
 199   myDrawer->TextAspect()->Aspect()->SetTextZoomable (true); // the whole object is drawn within transformation-persistence
 200   // this should be forced back-face culling regardless Closed flag
 201   myDrawer->TextAspect()->Aspect()->SetFaceCulling (Graphic3d_TypeOfBackfacingModel_BackCulled);
 203   Graphic3d_MaterialAspect aMat (Graphic3d_NameOfMaterial_UserDefined);
 204   aMat.SetColor (Quantity_NOC_WHITE);
 205   aMat.SetAmbientColor (Quantity_NOC_GRAY60);
 207   const Handle(Graphic3d_AspectFillArea3d)& aShading = myDrawer->ShadingAspect()->Aspect();
 208   aShading->SetInteriorStyle (Aspect_IS_SOLID);
 209   // this should be forced back-face culling regardless Closed flag
 210   aShading->SetFaceCulling (Graphic3d_TypeOfBackfacingModel_BackCulled);
 211   aShading->SetInteriorColor (aMat.Color());
 212   aShading->SetFrontMaterial (aMat);
 213   myDrawer->SetFaceBoundaryDraw (false);
 215   *myBoxEdgeAspect  ->Aspect() = *aShading;
 216   myBoxEdgeAspect->SetColor (Quantity_NOC_GRAY30);
 217   *myBoxCornerAspect->Aspect() = *aShading;
 218   myBoxCornerAspect->SetColor (Quantity_NOC_GRAY30);
 219 }
Jerome Monaco's picture

Hi gkv, sorry for my late answer.
I am using Attributes()->SetShadingModel( Graphic3d_TypeOfShadingModel::Graphic3d_TOSM_UNLIT ) after ViewCube creation.
My initial goal was to have the same view cube whatever are the view rendering method PBR/Phong and lights (like in CAD Assistant).
Best regards.

Jerome Monaco's picture

Hi gkv, I finally found the solution here below, if some people are interested in.
Best regards

// m_vc is handle to view cube created before

m_vc->SetTextColor( Quantity_NOC_BLACK );
m_vc->SetBoxColor( Quantity_NOC_WHITE );
m_vc->SetDrawEdges( true );

m_vc->BoxEdgeStyle()->Aspect()->SetShadingModel( Graphic3d_TypeOfShadingModel::Graphic3d_TOSM_UNLIT );
m_vc->BoxEdgeStyle()->SetColor( Quantity_NOC_GRAY60 );

m_vc->BoxCornerStyle()->Aspect()->SetShadingModel( Graphic3d_TypeOfShadingModel::Graphic3d_TOSM_UNLIT );
m_vc->BoxCornerStyle()->SetColor( Quantity_NOC_GRAY60 );

const opencascade::handle<Prs3d_Drawer> &drw( m_vc->Attributes() );
drw->SetShadingModel( Graphic3d_TypeOfShadingModel::Graphic3d_TOSM_UNLIT ); /// Define BoxSide shading model
drw->FaceBoundaryAspect()->Aspect()->SetColor( Quantity_NOC_BLACK );
drw->SetFaceBoundaryDraw( true );