2015-09-02 03:44:16 +03:00
|
|
|
# version 100
|
|
|
|
|
|
|
|
precision mediump float;
|
|
|
|
|
2016-05-18 13:04:27 +03:00
|
|
|
// Input vertex attributes (from vertex shader)
|
2015-09-02 03:44:16 +03:00
|
|
|
varying vec2 fragTexCoord;
|
2016-05-18 13:04:27 +03:00
|
|
|
varying vec4 fragColor;
|
2015-09-02 03:44:16 +03:00
|
|
|
|
2016-05-18 13:04:27 +03:00
|
|
|
// Input uniform values
|
2015-09-02 03:44:16 +03:00
|
|
|
uniform sampler2D texture0;
|
2016-07-19 11:57:35 +03:00
|
|
|
uniform vec4 colDiffuse;
|
2015-09-02 03:44:16 +03:00
|
|
|
|
2016-05-18 13:04:27 +03:00
|
|
|
// NOTE: Add here your custom variables
|
2015-09-02 03:44:16 +03:00
|
|
|
|
|
|
|
float hatchOffsetY = 5.0f;
|
|
|
|
float lumThreshold01 = 0.9f;
|
|
|
|
float lumThreshold02 = 0.7f;
|
|
|
|
float lumThreshold03 = 0.5f;
|
|
|
|
float lumThreshold04 = 0.3f;
|
|
|
|
|
|
|
|
void main()
|
|
|
|
{
|
|
|
|
vec3 tc = vec3(1.0, 1.0, 1.0);
|
|
|
|
float lum = length(texture2D(texture0, fragTexCoord).rgb);
|
|
|
|
|
|
|
|
if (lum < lumThreshold01)
|
|
|
|
{
|
|
|
|
if (mod(gl_FragCoord.x + gl_FragCoord.y, 10.0) == 0.0) tc = vec3(0.0, 0.0, 0.0);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (lum < lumThreshold02)
|
|
|
|
{
|
|
|
|
if (mod(gl_FragCoord .x - gl_FragCoord .y, 10.0) == 0.0) tc = vec3(0.0, 0.0, 0.0);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (lum < lumThreshold03)
|
|
|
|
{
|
|
|
|
if (mod(gl_FragCoord .x + gl_FragCoord .y - hatchOffsetY, 10.0) == 0.0) tc = vec3(0.0, 0.0, 0.0);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (lum < lumThreshold04)
|
|
|
|
{
|
|
|
|
if (mod(gl_FragCoord .x - gl_FragCoord .y - hatchOffsetY, 10.0) == 0.0) tc = vec3(0.0, 0.0, 0.0);
|
|
|
|
}
|
|
|
|
|
|
|
|
gl_FragColor = vec4(tc, 1.0);
|
|
|
|
}
|