Post-rendering Pencil Effect

This effect is achieved by the creation of an image-effect shader made with Unity3D.

The shader works in the following way: the shader will compare the constrats between pixels and draw a pixel here. By this way, the edges of the meshes appears and looks like pencil.

Here is a part of the formula I used:

 for(int j = 0; j < ANGLENUM; j++)
{
float2 dir = float2(1.0, 0.0) ;
pR(dir, j * PI2 / (2.0 * ANGLENUM));

float2 grad = float2(-dir.y, dir.x);

for(int i = -RANGE; i <= RANGE; i += STEP)
{
float2 b = normalize(dir);
float2 pos2 = screenPos + float2(b.x, b.y) * i;

if (pos2.y < 0.0 || pos2.x < 0.0 || pos2.x > _ScreenParams.x || pos2.y > _ScreenParams.y)
continue;

float2 g = getGrad(pos2, _OutlineDensity);

if (sqrt(dot(g,g)) < _GradThresh)
continue;

weight -= pow(abs(dot(normalize(grad), normalize(g))), _Sensitivity) / floor((_OutLineTresh * RANGE + _TresholdRange) / STEP) / ANGLENUM;
}
}