The normals are interpolated linearly so the faceting can’t be fixed at the moment, but with higher resolution mesh or more math savy people (or UE4 will do smooth interpolated normals) this could be improved upon.
Lemme know if you find it useful.
Built in 4.16 but can be for any version.
Zip attached
---- Updated with function to include PostProcess
---- Updated 2 - New function based off BasePassPixelShader.usf recreated in function attached with image to recreate it.
@mserena: Hi, looks interesting. I just had a brief look on the shader (your supplied uasset from the zip only works in 4.16, 4.15 and earlier versions do not recognize it).
A question: can you please supply more info or explain how you have used your MF in the material from the examples (picture above and video) - maybe you can post a screenshot of the material BP?
@mserena: thanks - got it working in 4.14, of course In your example video how did you setup your red/green material? … just using a lerp function between colors an applying the MF output to the alpha input of the lerp?
Sure thing, just updated my post to include a PP function to do it. Tried to incorporate into the same function but it complained about it being used in an opaque material.
But the process is just replace the PixelNormalWS with sceneTexture : worldNormal
Thanks mserena, this is awesome. I working for a surgical simulator company and I’m trying to use your shader to fill the mesh cracks with blood but the threshold is stock on fine details, I’m trying to change it to the bigger shapes but have a hard time to find what to change. I wonder if you could hint me where I should start? And Do you think that would be possible to fill the curvature of overlapping objects cracks? Well thank you if you can’t help anyway, this is already awesome giving it free.
Hi, I would be very interested in this as it is exactly what I need for my project. I do not see a download link and apparently, it’s not working on new versions anyways. I wouldn’t mind paying for such a plugin.
Thank you Mserena for the great resource. I got a variation of this technique to work in 4.25 and 4.26. I put the variation on the UE4 marketplace so others could try it out.
There are a few limitations, it doesn’t seem to work great for edge wear on low poly right angles. It works better on high-poly (10k+ tris) objects.
If you’re looking for edge wear in UE4, this Polycount thread helped me
I think there is a couple of mistake here, first you do transforms from screen space to world space, it should be the opposite, also you divide by the normals length in the end, but normals in UE4 are automatically normalized, so they should be equal to one. I am no GLSL expert but in the original code it was referring to vertex, due to the nature of the algorithm dividing by distance to vertices or even pixels could make sense but I am not sure.