- Home /
[Unity Shaders] How to Get Triangles of the Mesh ?
Im new to shaders.I want to get All triangles on the mesh and rotate them around a fixed point(center of triangle).
I dont know how to cut out the triangles. Can I take the mesh apart (into triangles) in vertex shader? if not how can I create new triangle for each 3 vertex?
Answer by Bunny83 · Jul 15, 2017 at 11:28 PM
This can only be done with a Geometry shader. A vertex shader only processes one vertex at a time. It has no information about triangles. The fragment shader is the last stage after a triangle is rasterized. The fragment shader is executed for every fragment. It also has no information about the triangle. It receives the interpolated vertex attributes.
Geometry shaders require either DirectX 11+ or OpenGL 4+. Also keep in mind that Geometry shader do not work with Unity's surface shader, so you have to write the whole shader yourself. For an example just see this post
Your description about what you actually want to do is very vague / unspecific.
I want to apply a rotation matrix to 2 vertex about the other vertex in every triangle.now I just need the matrix transform
Your answer
![](https://koobas.hobune.stream/wayback/20220612130353im_/https://answers.unity.com/themes/thub/images/avi.jpg)