SetColor, wrong colors

I create a box and set its color to black

BRepPrimAPI_MakeBox mb(1,1,1);
Handle_AIS_Shape mybox = new AIS_Shape(mb.Shape());
mybox->SetColor(Quantity_NOC_BLACK);
context->Display(mybox);

However, it's not black, it's brownish. What am I doing wrong?

Best regards

Attachments: 
Forum supervisor's picture

Dear John,
This is expected behavior of method SetColor(), which modifies color properties of already assigned material.
You may assign another material using SetMaterial(Graphic3d_NOM_PLASTIC) in advance (default material is Gold, which has physical properties; Plastic is more reliable for color customizations) to achieve more predictable color modulation.
See below Draw reproducer:

pload MODELING VISUALIZATION
box b 1 2 3
vinit View1
vtop
vsetdispmode 1
vdisplay b
vfit
vsetmaterial b plastic
vsetcolor b black

Best regards
FSR

andgre1's picture

Thanks!