MostHost_LA:
If you are just interested in curvature - which is static on static models - why not bake it as a texture like we all do when applying paint/wear etc?
For morphing meshes its a bit harder, since it can’t be pre-bake.
You would really have to rewrite half the engine to do it. Parricularly because you can’t access individual vert data from a shader. And more to the case, there isn’t any built in way to tell how close one vert is to another at all form the shader side - or any engine side for that matter.
instead of loosing your mind like that. Cheat it.
bake the extreme pose curvature textures and lerp between them based on bone angle - kinda like they did for the digital human facial expression normal maps.
In fact, exactly the same concept, you just use 2 curvature maps to derive the somewhat correct approximation.
No idea how that’ll look for you, but if the intention is to increase wear/tear on the shader when a metal bar bends, this should work perfect…
Suthriel:
So it isn´t possible to calculate the curvature here in UE for models, that do not come with this stuff already baked? If it would be possible, i guess, it would also help some edge shaders for those toon shaders, as in, not only working in screen space, but for the complete mesh and make it work in raytraced reflections too.
Chosker:
modifying the entire engine pipeline to pass the data all the way from the mesh to the shader and output as material nodes is probably not worth the huge effort.
the easiest way would be to bake the curvature into the mesh vertex color or into a separate texture. or making a new UV channel where you store the curvature value as the UV position (you only need one axis in the UVs)
out of the 3 solutions above I’d probably pick the extra UV channel simply because it gives more freedom and versatility. for reference, SpeedTree stores all its tree branch/wind/etc properties as extra UV channels.
using the mesh vertex color has as downside that you lose a vertex color channel for vertex paint if you need that, and baking it to a texture makes it much less versatile as you need to manually pass it to the shader etc.
Thanks for replying here. Right now, I’m using Nvidia FaceWorks to calculate the curvature first and then try to do pre-integrated skin in material part. That’s why I’m trying that way. And also, I tried to calculate curvature from custom material function and it works fine, but not sure about the satisfactory quality.