I want to be able to visualise the uv seams of a model, like it is possible in some 3D modeling software. Purpose is to “showcase” the work of an artist: I would like to visualize it on the mesh.
As I’m not sure how to proceed, does anyone have a shader that does that ? Or could you point me a solution to achieve that effect ?
UV seams are located between triangles that share the same position vertices but have different uv-vertices. This information is lost after the mesh is imported, since Unity uses interleaved vertex properties, so only vertices for which all vertex properties (position, uv, normal etc) are shared by multiple triangles will remain being shared. Therefore you won’t be able to do that simply in a shader.
I would probably iterate over all triangles of the mesh, check for each edge whether there is another edge in the mesh that has equivalent uv coordinates on both vertices and if not, add that edge to a list. Afterwards render all these edges using a line renderer.
I like the idea, but my meshes are quite complex (huge number of triangles)
“iterate over all triangles of the mesh / check for each edge whether there is another edge in the mesh that has equivalent uv coordinates on both vertices and if not, add that edge to a list. Afterwards render all these edges using a line renderer.”
that sound costly to calculate all line renderer points position at runtime while model move in scene
Alternatively, would it be realistic to “compute” a texture with UV seams drawn on it, and then use that texture on the mesh material ?
Note, this has nothing to do with Unity, or rather nothing to do with a decision made by Unity. This is because all GPUS and real time graphics APIs expect mesh data in this format.
Yes. That is the solution I described in my response to your duplicate thread.