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?

Thank you so much for your detailed answer BananableOffense. This solution works really well with meshes that are made of only of quads.

Since you seem to be well versed on this subject, I would like to ask you more questions on the subject if you don’t mind.

The solution that you have proposed requires a custom unwrap that unwraps all the quads within the the 0-1 UV space (I was able to use your solution, with good results, as showcased in the screenshot included in this post). The Unity shader example that I have posted above, created by Firnox, doesn’t require a custom UV unwrap. Also, his solution is using barycentric coordinates to calculate the longest edge of each triangle to determine if it should be displayed or not. Like explained in this video:

Basically his solution/algorithm appears to be UV unwrap agnostic and can process any type of mesh that is made out of Ngons, Triangles or Quads (and if I understand correctly, all the mesh data is triangulated in Unreal anyways, so his solution works on triangles) and yet still output a very good result that displays (mostly) only quads, whenever possible. So while the result isn’t purely displaying quads, in terms of workflow VS end result quality (e.g. not requiring a custom unwrap), it seems to be an acceptable trade off.

Based on this information, do you think that a similar result could be possible to achieve in Unreal, and if so, how? Would it require custom HLSL code? Would it require to add the barycentric coordinates in the mesh using geometry scripting, like the example you have posted above?

I know that many people have been looking for a solution about this subject, for many years. I hope that the information contained in this thread will help them, like me, solve this issue. Again, thank you so much for your time. Your help on this subject is greatly appreciated.

1 Like