0
\$\begingroup\$

I am designing a LEGO brick shader in UE5 and wanted to add a scratch normal map to it. But I only want that scratch normal map to apply to where there is an edge to a mesh. The material uses triplanar mapping, so I can’t use UV maps. Is there any way to apply a shader only to the edges of meshes without using UV maps?

\$\endgroup\$
7
  • \$\begingroup\$ Are you able to use vertex colours to mark the edges? \$\endgroup\$
    – DMGregory
    Commented Jan 12, 2023 at 15:11
  • \$\begingroup\$ Will that work? I am using triplanar mapping so I an apply this to any mesh. Will vertex colors automatically adapt to the mesh the material it is applied to? \$\endgroup\$ Commented Jan 12, 2023 at 15:12
  • \$\begingroup\$ use a mask texture \$\endgroup\$
    – Raildex
    Commented Jan 12, 2023 at 15:15
  • 1
    \$\begingroup\$ No, vertex colours are part of the data authored into the mesh. To achieve the effect you want, the mesh needs to convey to the shader some information about where its edges are - the shader does not otherwise have any access to that information. A triangle edge might be a visible edge (like a fold in the object's surface), or it could just be an internal seam on a flat surface, which you don't want to scratch up. So the shader needs some non-local information to make that decision, which needs to be encoded into the mesh itself. \$\endgroup\$
    – DMGregory
    Commented Jan 12, 2023 at 15:54
  • 1
    \$\begingroup\$ triplanar mapping has nothing to do with that. it's mesh dependent. be it with uvs and a mask texture or vertex colors \$\endgroup\$
    – Raildex
    Commented Jan 12, 2023 at 18:34

0

You must log in to answer this question.

Browse other questions tagged .