NokiMo
Mithos56
Mithos56

patreon


How I set up a matcap shader in Unreal Engine 4

So I wanted to show the process I used to set up a Matcap shader in unreal engine. 

I'd like to start by saying most of the credit is to a Maxwell R Taylor, who has an excellent tutorial available on youtube to show you how to set up the material function that does the computation for the matcap. 


His tutorial can be found here:  https://www.youtube.com/watch?v=OwA5qhQiRfg


One note on his tutorial.  At around 9:48 in his video he uses masks to break up a vector.  There is a quick cut, so he doesn't quite clearly state it, but he changes the masks so they are each masking one channel, the top is R, the middle is G and the bottom is B.


Following his tutorial will get you a basic Matcap shader all set up.  He even includes a link to download some matcaps.


So how can this be adapted to work on shading a character?


Its actually not a lot added on.   We simply need to combine it with a base texture.  To do that, I treated the new shader like a multiply, and simple multiplied the results by the base texture to get a combination of the two. 



 The other change that I needed to make was getting the shader some value.  Matcap shaders by design don't really rely on actual lighting, and while this gives us a really nice saturated look. However, when I'm in a game environment, if the shader completely ignores the scenes lights, that makes it look out of place.  Additionally, I lose some control not being able to affect the shader by lighting directly.


So first, I changed the shader to follow the default lit shading model.  As a compromise, I dimmed the value a bit by multiplying it(in this case by .7, that gave me a value that I liked).  I also have it plugged not just into the emissive channel, but the base color as well.  These changes allowed it to be affected by lighting a bit. 




This was the final result:

Normal PBR shader is on the left, the matcap shader is on the right.


That should be just about it! 

I'm still looking into getting the same saturated color, while improving the value of the matcap, and if I have any updates I'll be sure to let you know!


I'm also no expert on shaders, and if you know a way to accomplish this better, or more accurately, please let me know!

Comments

I love the new Metcap version...definitely an improvement. At first it seemed like the shading would be a problem, but I think it looks great now. When you see her side by side with the old version, it almost makes her look like she was sick and pale. The Metcap version makes her skin glow and the other colors stand out much better.

Bones12x2


Related Creators