Is it possible to create a custom wireframe shader/material in Unreal 5 that only (mostly) renders quads (and not triangles) like in this Unity engine shader example?

Here is my material on a mesh with both triangles and quads:


Note that the edge between the triangles and the quads are slightly thinner than the rest due to that edge being omitted from the wireframe.
Here’s the required UV layout.
image
This is actually the default UV layout in blender, so you can rapidly get this layout by selecting your mesh, hitting “U” to bring up the UV menu, and then “R” for reset. N-gons will also become centric, however they wont span the full 0-1 UV space. For example a 6 vertex n-gon will turn into a hexagonal UV, which while technically each vertex will be 1 unit away from the center of the UV, stretching from the severe misalignment of the true geometry vs the hexagon’s UV would cause really bizarre stretching as seen here:

You can see how the edge thickness on the n-gon is not sufficiently consistent. Technically any non rectangle or right triangle will see some minor variation of its edge thickness (somewhat visible on the trapezoids, but only because the edge is extra thick in this example.

Also note that blender’s reset UV rotated the hypotenuse of two adjacent but non coplanar triangles to face each other, causing one whole edge to be missing. Firnox’s method could potentially do this too.
It also aligned one of the hypotenuse to along a ridge (left side), which when viewed from above also looks like it’s missing because we can’t see the lower edge.
If these bother you, you may want to manually reorient the UVs of the problem triangles. The advantage of doing this in a real UV map is that you do have control over these details.

2 Likes