Technical Tech
1 min readApr 17, 2019

--

For anyone who needs to mod the other shaders from the matcap pack, 2 additions, add in the _Border variable so you can pick / vary the border offset on the matcap texture sampling (and update the calc to use it) and change the world normal calculation from

float3 worldNorm = normalize(unity_WorldToObject[0].xyz * v.normal.x + unity_WorldToObject[1].xyz * v.normal.y + unity_WorldToObject[2].xyz * v.normal.z);
worldNorm = mul((float3x3)UNITY_MATRIX_V, worldNorm);

to

float3 worldNorm = mul((float3x3)unity_ObjectToWorld, v.normal);

which is a bit of a simplification for the shader so these ones should run a bit faster too, bonus! I’n not really sure why the originals calculated like that (maybe it was something in Unity 5 that not an issue anymore)

--

--

Responses (1)