Hi! I am designing a LEGO brick shader 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?
Unreal doesn’t have any realtime equivalent of an ‘edge’ shader that’s evaluated in the material itself (like you would be able to do with, say, Vray).
You’ll need to generate the edge mask in advance, and then reference it, and you’ve therefore got two options:
- Vertex colours
Works well if the mesh is dense, or has nice clean bevels / edge loops
or - Generate some UVs that are just good enough to bake your edge mask to a texture. Automatically generated ones are probably good enough, since this is all you are using them for, but this is still a bit of work.
There might be some shader hacks under very specific use cases, such as your bricks always being slightly beveled, and perfectly axis aligned, but for general use you’ll need some kind of pre-process.
2 Likes
Hmm. I think what I’ll do instead is just add scratches to the meshes themselves before an FBX export to Unreal. Thanks, though!