Is there anyway to do interpolated shading on
a STL model?
there are some ones posted questions about this before,but still no answer.
Is it because OCC doesn't support interpolated shading?
mbd (not verified) Wed, 12/04/2002 - 19:36
Interpolated shading ???
What do you mean ...? Shading is already an interpolation ...
To see how shading works in OCC, have a look at src\Prs3d\Prs3d_ShadedShape.gxx
This algorithm assigns to each node of the triangulated model a Graphic3d_Array1OfVertexN (a graphic primitives that can store a XYZ coordinate and a Normal) - There are also Graphic3d_Array1OfVertexC (can store a color), Graphic3d_Array1OfVertexNT (can store a normal and a texture coordinate) ...-
And then, there is an interpolation of all normals to compute shading on the whole model ...
In your case, you have triangles, you can do the same.
What i mean is that three vertices in each triangle have different colors and
each triangle plane's color
is blended with the three colors.The following is a code which posted by Stephane 31/07/2000 . and Lee Sangsu have posted similar code 2002-09-14.
Handle(Graphic3d_Structure) theStructure = Handle(Graphic3d_Structure)::DownCast(aPresentation);
Handle(Graphic3d_Group) theGroup= new Graphic3d_Group(theStructure);
Graphic3d_MaterialAspect mat = myShadingAspect->Aspect()->FrontMaterial();
The result of a STL model is that all triangle's color are the same,it is not what i want.
The visualization functionality is very important in FEM. and i must use it to do Error analysis in
a STL Model.So, is there any one can help me? Thanks.
Wed, 12/04/2002 - 19:36
Interpolated shading ???
What do you mean ...? Shading is already an interpolation ...
To see how shading works in OCC, have a look at src\Prs3d\Prs3d_ShadedShape.gxx
This algorithm assigns to each node of the triangulated model a Graphic3d_Array1OfVertexN (a graphic primitives that can store a XYZ coordinate and a Normal) - There are also Graphic3d_Array1OfVertexC (can store a color), Graphic3d_Array1OfVertexNT (can store a normal and a texture coordinate) ...-
And then, there is an interpolation of all normals to compute shading on the whole model ...
In your case, you have triangles, you can do the same.
Have a look at this file ...
mbd
Thu, 12/05/2002 - 05:44
What i mean is that three vertices in each triangle have different colors and
each triangle plane's color
is blended with the three colors.The following is a code which posted by Stephane 31/07/2000 . and Lee Sangsu have posted similar code 2002-09-14.
Handle(Graphic3d_Structure) theStructure = Handle(Graphic3d_Structure)::DownCast(aPresentation);
Handle(Graphic3d_Group) theGroup= new Graphic3d_Group(theStructure);
Graphic3d_MaterialAspect mat = myShadingAspect->Aspect()->FrontMaterial();
mat.SetReflectionModeOff(Graphic3d_TOR_AMBIENT);
mat.SetReflectionModeOff(Graphic3d_TOR_DIFFUSE);
mat.SetReflectionModeOff(Graphic3d_TOR_SPECULAR);
mat.SetReflectionModeOff(Graphic3d_TOR_EMISSION);
myShadingAspect->SetMaterial(mat);
theGroup->SetPrimitivesAspect(myShadingAspect->Aspect());
Aspect_Array1OfEdge aListEdge(1, 3 );
aListEdge.SetValue(1,Aspect_Edge(1,2,Aspect_TOE_VISIBLE));
aListEdge.SetValue(2,Aspect_Edge(2,3,Aspect_TOE_VISIBLE));
aListEdge.SetValue(3,Aspect_Edge(3,1,Aspect_TOE_VISIBLE));
theGroup->BeginPrimitives();
---begin loop on all my points ---
Graphic3d_Array1OfVertexNC theArray1(1,3);
Graphic3d_VertexNC aVertexNC(V1->X(),V1->Y(),V1->Z(),V1->NX(),V1->NY(),V1->NZ(),V1->GetColor());
theArray1.SetValue(1,aVertexNC);
aVertexNC = Graphic3d_VertexNC(V2->X(),V2->Y(),V2->Z(),V2->NX(),V2->NY(),V2->NZ(),V2->GetColor());
theArray1.SetValue(2,aVertexNC);
aVertexNC = Graphic3d_VertexNC(V3->X(),V3->Y(),V3->Z(),V3->NX(),V3->NY(),V3->NZ(),V3->GetColor());
theArray1.SetValue(3,aVertexNC);
theGroup->TriangleSet(theArray1,aListEdge);
-- end loop
The result of a STL model is that all triangle's color are the same,it is not what i want.
The visualization functionality is very important in FEM. and i must use it to do Error analysis in
a STL Model.So, is there any one can help me? Thanks.