Hello
@devdscm
You may play around materials on your shape. The best sample, for sure, is AIS package. But, some additional materials:
- to avoid phong-based lightning on your shape(it will switch it OFF), just prepare material with the code similar to:
C++:
Graphic3d_MaterialAspect material(name);
material.SetMaterialType (Graphic3d_MATERIAL_ASPECT);
material.SetSpecularColor(Quantity_NOC_BLACK);
material.SetAmbientColor(Quantity_NOC_BLACK);
material.SetDiffuseColor(Quantity_NOC_BLACK);
material.SetEmissiveColor(Quantity_NOC_BLACK);
material.SetShininess(0);
- for some style on our project(with phong-based lightning ON), we worked around specular part of material color like the next. Here we corrected material to smoth lightning on the model.
C++:
Graphic3d_MaterialAspect material(Graphic3d_NameOfMaterial_Aluminum);
material.SetAmbientColor(Quantity_Color(200. / 255., 200. / 255., 200. /255., Quantity_TOC_sRGB));
material.SetSpecularColor(Quantity_NOC_GRAY50);
drawer->ShadingAspect()->SetMaterial(material);
Some theory: OpenCASCADE visualization is based on using OpenGl shaders. Lightning, materals, shading and others use GLSL shaders. At the same time you’re welcome to implement your own shader and add it for execution to OpenCASCADE visualization. How doing this, start investigating from ‘SetShaderProgram’ of Prs3d_Drawer. Here, OpenCASCADE provides us with a DRAW command and some tests how to try this. The command name is ‘vshader’.
Also, pay attention, that PBR Metallic-Roughness shading model is implemented in OpenCASCADE and described in issue
https://tracker.dev.opencascade.org/view.php?id=30700.
The result from the issue is the next:
It is interesting to know which way you’ll chose and what results you achieve, please be-on-the-line)