1
\$\begingroup\$

Let's say I create a cube using mesh triangles similar to the graph below. I would like to make those 12 edges visible in play mode so user/player can see them too (but without the diagonals).

What would be the best way to approach this problem in unity? Hundreds of cubes will be created in run time using mesh/triangles and the vertices position (vector3 value) will change at some point, so I am wondering if there's a way that allows those edges to change/move along when the mesh/triangles change and the edges still remain visible the whole time.

The desired outcome should be similar to the shaded wireframe in the scene view. Any help would be appreciated.

enter image description here

\$\endgroup\$
3
  • \$\begingroup\$ Presumably you want a custom shader. Try searching "unity outline shader" or "unity wireframe shader" \$\endgroup\$
    – Kevin
    Commented Aug 20, 2020 at 21:29
  • \$\begingroup\$ Thanks Kevin. After some searching using "unity wireframe shader", I found a solution. Wireframe without Diagonal Combine this shader with the original shader using mutiple pass solved the problem. It's also possible to use multiple materials but that may slow performance. Thanks again. \$\endgroup\$
    – karen66
    Commented Aug 21, 2020 at 19:23
  • \$\begingroup\$ Great! It could help other users in the future if you post your solution as an answer to your own question. \$\endgroup\$
    – Kevin
    Commented Aug 21, 2020 at 19:43

1 Answer 1

1
\$\begingroup\$

Wireframe without Diagonal Combine this shader code with any shader code/file using mutiple pass solved the problem. It's also possible to use multiple materials but that may slow performance.

Note: Unfortunately, this solution uses geometry shader which is not supported in mobile devices.

\$\endgroup\$
1
  • \$\begingroup\$ This is currently a link-only answer. You van improve it by editing your answer to include at least a rough overview of the solution explained at the link, so that even if the link rots away the information persists to help future readers. \$\endgroup\$
    – DMGregory
    Commented Aug 23, 2020 at 18:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .