SRP Batcher + OpenGL bug:
https://forum.unity.com/threads/srp-batcher-does-not-work-with-opengles3.1095937/
Shadow Cascade
Unity Doc: https://docs.unity3d.com/Manual/shadow-cascades.html Cat Like Coding: https://catlikecoding.com/unity/tutorials/scriptable-render-pipeline/directional-shadows/
Shadow map pixels close to the Camera look enlarged and chunky to those farther away. Unity solves this problem by splitting the frustum area int otwo zones based on the distance from the camera, and use two separate shadow map. The resolution of each map is staged reduced.
It also increased Drawcall: https://forum.unity.com/threads/unity-draw-5-4-introducing-more-draw-calls.426185/
Outline
https://alexanderameye.github.io/notes/rendering-outlines/
Fresnel Effect
Out = pow((1.0 - saturate(dot(N, V))), P)
The edge becomes stronger when approaching the grazing angle. use smoothstep
to modify it. It only looks good with sphere and fixed distance.
Vertex Extrusion
Duplicate the original mesh and extrude the vertices to form the outline. The duplicated version shown behind the original.
Edge Detection
Detect the discontinuities of the gradient. The source of continuity could be depth, normals, and color, or even custom data by painting the vertex color on the mesh. Combine the result of different discontinuities to have the best result. There are various operators to detect the gradient:
- Roberts
$$
G_x =
\begin{vmatrix}
-1 & 0 \
0 & 1
\end{vmatrix}
G_y =
\begin{vmatrix}
0 & -1\
1 & 0
\end{vmatrix}
$$
- Prewitt
$$
G_x =
\begin{vmatrix}
-1 & 0 & 1 \
-1 & 0 & 1\
-1 & 0 & 1
\end{vmatrix}
G_y =
\begin{vmatrix}
-1 & -1 & -1 \
0 & 0 & 0\
1 & 1 & 1
\end{vmatrix}
$$
- Sobel
$$
G_x =
\begin{vmatrix}
-1 & 0 & 1 \
-2 & 0 & 2\
-1 & 0 & 1
\end{vmatrix}
G_y =
\begin{vmatrix}
-1 & -2 & -1 \
0 & 0 & 0\
1 & 2 & 1
\end{vmatrix}
$$