Debian Codegraph @

Data/Sys/Shaders/auto_toon.glsl

raw
1 void main()
2 {
3 float4 to_gray = float4(0.3,0.59,0.11,0);
4
5 float x1 = dot(to_gray, SampleOffset(int2( 1, 1)));
6 float x0 = dot(to_gray, SampleOffset(int2(-1,-1)));
7 float x3 = dot(to_gray, SampleOffset(int2( 1,-1)));
8 float x2 = dot(to_gray, SampleOffset(int2(-1, 1)));
9
10 float edge = (x1 - x0) * (x1 - x0) + (x3 - x2) * (x3 - x2);
11
12 float4 color = Sample();
13
14 SetOutput(color - float4(edge, edge, edge, edge) * 12.0);
15 }