how to hiden the unncessary lines or edges on the same complete plane when pyqtgraph displays a STL file

I found a STL viewer program using pyqtgraph from STLViewer
pyqtgraph document
the key parameters are set as

# color is a tuple in the form RGBA  (0.4,0.9,0.6,1)`
mesh = gl.GLMeshItem(meshdata=meshdata, smooth=True, drawEdges=True, drawFaces=True,  shader='balloon',color= (0.4,0.9,0.6,1))

a stl file appearance displays as the following

enter image description here

This appearance is not I want, since it displays many edges even though on the same complete plane.

and if set drawEdges=False then it displays as

enter image description here

However, the concrete edges I can touch are also hidden, this is not I want too.

What I want is like this

enter image description here

this is painted by pyVTK

the main program is

import vtk
reader = vtk.vtkSTLReader()
mapper = vtk.vtkPolyDataMapper()  # maps polygonal data to graphics primitives
actor_0 = vtk.vtkLODActor()
actor_0.SetScale(1000, 1000, 1000)
actor_0.GetProperty().SetSpecularColor(1.0, 1.0, 1.0)


You can change the color of the surface based on the normal vector by specifying the shader. viewNormalColor seems to fit what you’re looking for among the builtin shaders.

Using viewNormalColor shader

mesh = gl.GLMeshItem(meshdata=meshdata, smooth=True, drawFaces=True, drawEdges=False, shader='viewNormalColor', glOptions='opaque')

There’s an example code of using builtin shaders.

But this is too flashy. So, I did a search and found that it is possible to add a custom shader.

Here is the code for adding a custom shader. I don’t know much about shaders, but I modified the viewNormalColor shader to make the surface green.

gl.shaders.Shaders.append(gl.shaders.ShaderProgram('myShader', [
            varying vec3 normal;
            void main() {
                // compute here for use in fragment shader
                normal = normalize(gl_NormalMatrix * gl_Normal);
                gl_FrontColor = gl_Color;
                gl_BackColor = gl_Color;
                gl_Position = ftransform();
            varying vec3 normal;
            void main() {
                vec4 color = gl_Color;
                color.x = 0.0;
                color.y = (normal.y + 1.0) * 0.5;
                color.z = 0.0;
                gl_FragColor = color;

Then pass the shader name.

mesh = gl.GLMeshItem(meshdata=meshdata, smooth=True, drawFaces=True,
                         drawEdges=False, shader='myShader', glOptions='opaque')

Using myShader

I hope you will find it useful.