Using Custom Matcaps in Blender

What is a Matcap?

A matcap, short for "material capture," is a quick and performant way to fake a material appearance on an object using only a texture. Matcaps are commonly used for lookdev in graphics software and in video games and other real-time rendering to fake metallic or reflective materials and maintain performance—but they're also incredibly useful for more artistic NPR (non-photorealistic rendering) workflows, as seen in my Red Shoes and Rainbow Dragon models.

This guide details how to map a pre-made matcap texture in a material for Cycles and EEVEE using the Shader Editor.

The full node tree from this tutorial is also included in my Modular Matcaps Pack with additional mapping features, 26 pre-made matcap textures, and a set of over 50 modular matcap components to create a broad array of variations and add a unique touch to your renders with ease.

How to Map a Matcap

In short, we'll need to effectively create a custom UV projection mapping for our matcap texture using the object's normals, then we can further tweak and manipulate that as needed.

1. Rotate Object Normals towards the Camera

Add a "Geometry" or "Texture Coordinates" node to get the object's normals, and attach it to a "Vector Transform" node. Set it to "Normal" and transform from world normals to "Camera." (Note: you might choose object normals for some scenarios, but I recommend world for most.)

1a. Plug In Your Matcap Texture

Now let's plug in our matcap texture to see how it looks.

2. Convert Vector Space to Normal Space

As you can see, it's a bit wrong. A proper UV map only uses the X and Y (red and green) values and only from a range of 0 to 1. This is called normal space, but as you might have noticed in step 1's image, it is currently still in vector space—a range from -1 to 1.

To fix it, let's add a "Vector Math" node, set it to "Multiply Add," multiply it by 0.5, then add 0.5. (Technically, you only need to do this to the X and Y values.)

3. Adjust for Perspective

Now it almost looks finished! But depending on your matcap, you might notice that it looks a bit wrong and distorted towards the edges of your viewport—plus it doesn't move when panning the camera around, which looks rather odd compared to a real metallic or reflective material.

That's because the camera transform we did earlier doesn't account for perspective. It's not pointed towards the camera; only towards a hypothetically endless plane that constitutes the orthographic direction of the camera.

To fix it, we'll add a "Vector Rotate" node between the first two steps, set it to "Euler" rotation mode, and then we'll perform some magic to calculate the rotation, seen below.

Here, we're getting the view vector (the direction our camera is facing) from the "Camera Data" node, flipping its X and Y values, and inverting the former (X). (Y1 = -X; X1 = Y) Now our matcap looks correct no matter where it sits in the viewport!

4. Bonus Tweaks

But why stop there? Now we can make our matcap mapping node more customizable.

How to Scale and Rotate

Simply add a "Mapping" node between Steps 2 and 3 to easily fine-tune the scale, rotation, and position of the matcap.

Using a Custom Normal Map

To use a custom normal map with the matcap, just drop in your normal map texture, connect it to a "Normal Map" node, and use that in pace of the object's default normals we used in Step 1. Just connect it to the same "Vector Transform" node as before.


Report

How to Blur a Texture in Blender

I've needed to dynamically blur a texture rather often when working, and all the methods I have seen are needlessly complicated when the solution in Blender's material nodes is actually very simple.  This is a very quick and simple tutorial for blurring any texture—even prodecurals—dynamically with only 2 additional nodes.

All you need to do is place a MixRGB node between the mapping and the texture nodes, set it to Linear Light, and connect a Noise Texture's color output to the Color2 input like so.  

A larger noise scale value will produce a higher quality blur but will also be slightly slower.  I use a value of 20000 in most cases (as higher values produce no noticeable difference).  Then you can use the fac input to precisely and dynamically adjust the blur amount—you can even keyframe it or connect a driver to it like any other.  This method can even be used for any procedural node that includes a vector input as well.  Be sure to also set your render/viewport samples to a larger amount to reduce noise, and this works in both EEVEE and Cycles.

And that's it; it's that simple.  No third-party node downloads or complicated node setups required.

Personally, I find this most useful when creating NPR materials and need a dynamic fake roughness effect, but it has plenty of other uses as well.  I hope someone finds this helpful.

---

1.マッピングとテクスチャの間にリニアライトが置きなさい。
2.ノイズテクスチャのカラー出力からリニアライトの色2が繋ぎなさい。
3.ノイズテクスチャのスケールが2万と設定しなさい。
4.係数が設定しなさい 。

1. 在贴图和纹理之间放置一盏线灯。
2. 从噪声纹理的颜色输出中连接线性光的颜色 2。
3. 将噪点纹理比例设置为 20,000。
4. 设置系数。 

1. 매핑과 텍스처 사이에 선형 조명을 배치합니다.
2. 노이즈 텍스처의 색상 출력에서 선형 조명의 색상 2를 연결합니다.
3. 노이즈 텍스처 스케일을 20,000으로 설정합니다.
4. 계수를 설정합니다.

Report