Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Question Triangle vertices

Discussion in 'General Graphics' started by MatheusMarkies, Jun 6, 2021.

  1. MatheusMarkies

    MatheusMarkies

    Joined:
    Apr 16, 2017
    Posts:
    67
    Good Morning.
    How can I get the list of all vertices that participate in the construction of a triangle of a mesh?
    Mesh_fv.jpg
    I want something like this "face list"
     
  2. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    11,929
  3. MatheusMarkies

    MatheusMarkies

    Joined:
    Apr 16, 2017
    Posts:
    67
    Thanks for the answer!
    Used the mesh triangle but it only returns the triangles themselves. What I want is to get the 3 vertices that make up a triangle.

    I want to do the following. Create a list of vertexes. Each sequence of 3 vertices represents a triangle. So I can send this list to a Compute shader. So I can use the http://www.graphics.cornell.edu/pubs/1997/MT97.html
     
  4. Olmi

    Olmi

    Joined:
    Nov 29, 2012
    Posts:
    1,518
    @MatheusMarkies did you take a look at the manual like @bgolus suggested?

    Triangles array contains references to vertices which are stored in Mesh.vertices. So just get the vertices from the Mesh.vertices array based on the index numbers in the triangles array.