# How to make vertex colored squares show black borders

**URL:** https://discourse.vtk.org/t/how-to-make-vertex-colored-squares-show-black-borders/3863
**Category:** Support
**Created:** [July 28, 2020, 1:48pm UTC](https://discourse.vtk.org/t/how-to-make-vertex-colored-squares-show-black-borders/3863 "2020-07-28T13:48:20Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Cheng1087](https://discourse.vtk.org/user_avatar/discourse.vtk.org/cheng1087/32/1197_2.png) [@Cheng1087](https://discourse.vtk.org/u/Cheng1087)
#### Post date: [July 28, 2020, 1:48pm UTC](https://discourse.vtk.org/t/how-to-make-vertex-colored-squares-show-black-borders/3863/1 "2020-07-28T13:48:20Z")

</div>

I have a square with four vertices, color of each vertex is different.  
in order to distinguish this square from other squares, I want the border to be black color.  
Approximately as shown below, the triangle used vertex shader by `vtkPolyDataMapper::SetScalarModeToUsePointData()`, I also need a black border to distinguish it from others.  
how can I achieve this with only one actor.

 ![sss](https://discourse.vtk.org/uploads/default/original/2X/2/25a95c18aff0639e1944004bd6c3de6e14a3c574.png)

---

<div class="post-metadata">

### Author: ![Michael](https://discourse.vtk.org/user_avatar/discourse.vtk.org/michael/32/16_2.png) [@Michael](https://discourse.vtk.org/u/Michael)
#### Post date: [July 30, 2020, 1:44pm UTC](https://discourse.vtk.org/t/how-to-make-vertex-colored-squares-show-black-borders/3863/2 "2020-07-30T13:44:14Z")

</div>

See `vtkProperty::SetEdgeVisibility` and `vtkProperty::SetLineWidth` / `vtkProperty::SetEdgeColor`.

---

<div class="post-metadata">

### Author: ![Cheng1087](https://discourse.vtk.org/user_avatar/discourse.vtk.org/cheng1087/32/1197_2.png) [@Cheng1087](https://discourse.vtk.org/u/Cheng1087)
#### Post date: [July 31, 2020, 4:15am UTC](https://discourse.vtk.org/t/how-to-make-vertex-colored-squares-show-black-borders/3863/3 "2020-07-31T04:15:49Z")

</div>

In order for the polygon to be displayed normally, I need use `vtkTriangleFilter` to guarantee this.  
So if i use `vtkProperty::SetEdgexxxx`, it will result in the following.  
A square only have four edges, but the square shows five sides in the window.  
 ![点着色和边显示](https://discourse.vtk.org/uploads/default/original/2X/2/298e46ef277a7b3585d5a84d5a6a2704d8dd3732.jpeg)  
Anyway, thanks for your reply.

---

<div class="post-metadata">

### Author: ![Charles\_Gueunet](https://discourse.vtk.org/user_avatar/discourse.vtk.org/charles_gueunet/32/239_2.png) [@Charles\_Gueunet](https://discourse.vtk.org/u/Charles_Gueunet)
#### Post date: [July 31, 2020, 9:18am UTC](https://discourse.vtk.org/t/how-to-make-vertex-colored-squares-show-black-borders/3863/4 "2020-07-31T09:18:53Z")

</div>

You may want to have a look at the [vtkFeatureEdges](https://vtk.org/doc/nightly/html/classvtkFeatureEdges.html) class to get rid of the inner edges.

---

<div class="post-metadata">

### Author: ![Cheng1087](https://discourse.vtk.org/user_avatar/discourse.vtk.org/cheng1087/32/1197_2.png) [@Cheng1087](https://discourse.vtk.org/u/Cheng1087)
#### Post date: [July 31, 2020, 10:55am UTC](https://discourse.vtk.org/t/how-to-make-vertex-colored-squares-show-black-borders/3863/5 "2020-07-31T10:55:47Z")

</div>

thanks for your reply.  
It will help when it is a polygon, but most application scenarios i used are cubes or blocks. All of the edges are used by two polygon, `vtkFeatureEdges` can not find out the true boundary.
