Matcaps for UE4

This is so AWESOME. I could REALLY do with this :>

I hope Chronichol doesn’t mind if I post this here for those who would like to try to play with matcaps.
Taken from this thread on Polycount ->

Here is the result mixed from the polycount thread as a conviniet function so it can be easily reused for all sorts of effects besides emissive on unlit material. This is only the VAR version.

Hey guys, sorry for the lack of thread activity over the past week, been quite busy. I am assuming the consensus is to release it for testing and collaborative contribution sooner rather than later?
I’ll try getting an early version up. i’ll get it updated quickly before sharing it.

Yeah no problem, and Cool! Wish I had been able to spot more material online on the subject before starting, but then again might not have been as motivated knowing it was already done more or less :stuck_out_tongue: That function doesn’t seem to be VAR btw, looks more akin to my SEM material function. That said the difference between the 2 is slight, but to be VAR that one is missing a reflection vector.
I have encapsulated both VAR and SEM mapping methods into functions, a bit differently. there is an official ViewAlignedReflection coordinates node, but i made a lighter version.

adding a world aligned one is actually a very good idea, i was playing with world aligned before, but looking at that thread and thinking about it I must definitely add it. if i can I’ll try putting in a rotation vector, so you can for example put a gradient on, and rotate it to any angle :slight_smile:

and here’s some rather unrelated self promotion, and signs of something else creative I have been doing this past week. I might need to remove the Lucy statuette from the final release for legal reasons, so I might use this amongst some other things for some of the use-case examples

To be honest, didn’t give it too much time, just needed something for quick testing, sorry for any confusion.

Well I won’t have an upload ready for awhile. So hopefully this helps those like doC who are eager to jump in and test early. :slight_smile:

including both because the newer ones aren’t quite finished yet.

Here is the first versions of each material

and here are the encapsulated and revised versions so far, they allow much more reuse and flexibility, it is easier to integrate these functions into another custom material than the first iteration.

and HERE]( is a small sample of matcaps to play with too from the set, just press the “Download Album” for a nice zip

also quick preview

Thanks for posting the shader nodes.

Fantastic work with everything Chronichol! The materials that you shown so far in your screenshots look awesome!

Chronichol, I’m not exactly sure, but shouldn’t you rotate/flip the vector in your sem shader? Right now if you make a simple matcap with some specific detail “on top of the sphere” and apply it to a spherical mesh in UE, you will see the detail from bellow (I think even left/right is flipped).

thanks Sean :smiley:

I think i know exactly what you are experiencing, the artifact is fixable. I’ll clarify how in a moment. On the other hand there is another apparent byproduct of the FOV on the display of the matcaps, which I’m not sure you are pertaining to as well, It’s entirely logical if you think about the method, and how the surface normals in view space are what the matcap texture is being applied to, so if you see things at sheer left,right, top or down you’ll see the correlating edge colors of the matcap. The bizarre thing is the magnitude of FOVs distortion, which makes some things an issue and feel a bit “weird” and unnatural. Is in essence a byproduct of the fact your screen is a 2D surface, and the fact you are projecting a curved world onto that with FOV, Because let’s think about it for a second, we don’t get barrel distortion in your own periphery do we? so you wouldn’t be able to see surfaces perpendicularity change as significantly as it would on a 2D display. I am curious to see how proportional FOV distortion is on the oculus though :confused: worth noting regarding both the artifact and distortion I’ve tested matcaps in 3D software and it’s prevalent there too, it’s down to the fact the model is almost always centered on the screen during your workflow combined with a lower FOV that you fail to notice it.

So yeah the only way to get 1:1 “perfect” display of matcaps would be with orthogonal projection or some level of corrective rotation could theoretically work I will see if it’s worth pursuing, but not sure if it’s justified. I’d speculate it would require taking the screenVectors and using those to determine the corrective rotation, I think it’s possible. but might need to be a different project, to create a FOV correction node

but I believe your issue is the wrap around artifact. which is an artifact caused by the textures tiling method, you need to swap it from wrap to mirror

if you wanted to work with wrapping, you’d need to have uniform borders/rim colour, which is obviously a conflict with the very nature of most matcaps.

As I said, I didn’t put too much time into it, so I’m not on the level to talk about the issue expertly :), but I tried some flipping in my version of SEM and it seems to work ok (maybe a hack, maybe it’s only working for most of the situations but not all) without the need to change the tiling method.

actually i know exactly what you mean now, the actual matcap keeps flipping upside down, it seems like there is a bug in the split components function, it has gotten frustrating it’s flipped on it’s own 3 times now and i have to keep manually changing the vector order. so i’ve gone back to a component mask and vec2 multiply like the version you posted, if there is no more arbitrary flipping it will confirm it.

I can’t see how though, the function itself seems fine, there is no way there is any reordering happening within the function

also added masking support, both masking and normal maps are toggled on and off with a bool parameter.

Nice work mate!

Some more progress shots and testing, blending is quite powerful, considering doing a video soon, had a more comprehensive post the other day but a browser crash chewed it up. hoping to get it finalized by next week, making it a month since i started.

would be keen to check out some of them. are you still working on it?

I would definitely really be interested in seeing your node network. I was trying to figure out how you did this crazy madness :stuck_out_tongue:

That looks so ********* fantastic.

Could you upload this material?

Looks Awesome!. keep work hard!!

For my mind it will be very useful


Looks amazing

Did this dude die or something? Was looking forward to fooling around with this.