Fri, 02/10/2023 - 04:22
Forums:
Hello,
I want to make the surface of MeshVS_Mesh
shiny, as shown in picture1. In the picture left model is created using MeshVS_MeshPrsBuilder
, it can set the material through:
meshvs_mesh->GetDrawer()->SetMaterial(MeshVS_DA_FrontMaterial, Graphic3d_NOM_SHINY_PLASTIC);
But when I use MeshVS_NodalColorPrsBuilder
, I can't set the material with same function, and the display effect is on the right side of picture.
My test code is as follows,
Handle(MeshVS_Mesh) ais_mesh = new MeshVS_Mesh;
Handle(MeshDataSource) mesh_date = new MeshDataSource(mesh);
ais_mesh->SetDataSource(mesh_date);
// MeshVS_MeshPrsBuilder Set material successfully
// Handle(MeshVS_MeshPrsBuilder) mesh_prs_builder = new MeshVS_MeshPrsBuilder(ais_mesh);
// MeshVS_NodalColorPrsBuilder fail
Handle(MeshVS_NodalColorPrsBuilder) mesh_prs_builder = new MeshVS_NodalColorPrsBuilder(ais_mesh, MeshVS_DMF_NodalColorDataPrs | MeshVS_DMF_OCCMask);
for(int i = 1; i <= (mesh_date->GetEleNum()) * 3; i++)
{
mesh_prs_builder->SetColor(i, Quantity_NOC_BISQUE);
}
ais_mesh->AddBuilder(mesh_prs_builder, true);
ais_mesh->UnsetMaterial();
ais_mesh->SetDisplayMode(MeshVS_DMF_Shading);
ais_mesh->SetMeshSelMethod(MeshVS_MSM_PRECISE);
ais_mesh->SetHilightMode(MeshVS_DMF_Shading);
ais_mesh->HilightAttributes()->SetColor(Quantity_NOC_YELLOW2);
ais_mesh->GetDrawer()->SetBoolean(MeshVS_DA_DisplayNodes, Standard_False);
ais_mesh->GetDrawer()->SetBoolean(MeshVS_DA_ShowEdges, Standard_False);
ais_mesh->GetDrawer()->SetMaterial(MeshVS_DA_FrontMaterial, Graphic3d_NOM_SHINY_PLASTIC);
ais_mesh->GetDrawer()->SetBoolean(MeshVS_DA_ColorReflection, Standard_True);
Attachments:
Fri, 02/10/2023 - 20:55
MeshVS_NodalColorPrsBuilder
configures material to make mapped colors clearly visible - shading make harm considerably mapped information. The only option you have is to enableMeshVS_DA_ColorReflection
property. Otherwise, you may subclassMeshVS_NodalColorPrsBuilder
or implement your own presentation builder taking code of existing builders as references.Mon, 02/13/2023 - 06:31
OK,thanks for your reply!
Tue, 02/14/2023 - 09:17
Hello gkv,
When I use the
AIS_Triangulation
class, the gradient color seems to be combined with the color of the model's default material, how can I cancel the color of this material? Looking forward to your answer.Mon, 03/18/2024 - 10:46
Hello Frank,
Did you solve the problem? I'm having the same problem right now
Mon, 03/18/2024 - 11:26
You can initialize the material in the constructor and then modify the parameters
material.SetEmissiveColor(Quantity_NOC_BLACK)
Mon, 03/18/2024 - 11:44
thanks for your reply! But I don't know how to solve it.
In your above code, my changes are as follows,
Graphic3d_MaterialAspect material(Graphic3d_NOM_SHINY_PLASTIC);
material.SetEmissiveColor(Quantity_NOC_BLACK);
ais_mesh->GetDrawer()->SetMaterial(MeshVS_DA_FrontMaterial, material);
Mon, 03/18/2024 - 11:53
sorry, I don't know MeshVS. Finally, I used AIS_Triangulation to solve my problem.
Mon, 03/18/2024 - 11:56
OK,thanks for your reply!