How to make a side of TopoDS_Face transparent

I have a TopoDS_Face on XY plane to present as a platform. What I want is, when I look from above the platform, it's solid. But when I look form below the platform, it's transparent.

I try the following code, it did't works

Handle(AIS_Shape) m_Platform = new AIS_Shape(aTopoDS_Shape_Platform);
m_Platform->SetColor(Quantity_NOC_LIGHTGRAY);

Handle(Graphic3d_AspectFillArea3d) aAspect = new Graphic3d_AspectFillArea3d;
Graphic3d_MaterialAspect ama(Graphic3d_NOM_TRANSPARENT);
aAspect->SetBackMaterial(ama);
m_Platform->Attributes()->SetBasicFillAreaAspect(aAspect);

m_Context->Display(m_Platform, AIS_Shaded, 0, Standard_True);

 

Kirill Gavrilov's picture

Don't use Graphic3d_PresentationAttributes::BasicFillAreaAspect() - this property has another purpose and is not used by regular presentation builder.
What you are looking for is Prs3d_Drawer::SetShadingAspect() in most cases.

Max Chen's picture

Thank you !

It works now

Handle(AIS_Shape) m_Platform = new AIS_Shape(aTopoDS_Shape_Platform);
Handle(Prs3d_ShadingAspect) aShadingAspect = new Prs3d_ShadingAspect;
aShadingAspect->SetTransparency(1.0, Aspect_TOFM_BACK_SIDE);
m_Platform->Attributes()->SetShadingAspect(aShadingAspect);
m_Platform->SetColor(Quantity_NOC_LIGHTGRAY);
m_Context->Display(m_Platform, AIS_Shaded, 0, Standard_True);