shaders/soften-borders.frag
author František Kučera <franta-hg@frantovo.cz>
Thu, 28 Dec 2023 00:57:23 +0100
branchv_0
changeset 36 0ffb35999bb0
parent 28 4cbd9c0beb4c
permissions -rw-r--r--
modify phosphor-basic.frag for PDF presentations
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
bb715a82a8f1 project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     1
#version 330 core
bb715a82a8f1 project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     2
2
3faef2f5128e better GLSL variable names
František Kučera <franta-hg@frantovo.cz>
parents: 0
diff changeset
     3
uniform  sampler2D  uTexture;
28
4cbd9c0beb4c pass texture xattr 'shader-shark.texture.scale' to the shaders as 'uTextureScale' + update variable locations on each shader reload
František Kučera <franta-hg@frantovo.cz>
parents: 18
diff changeset
     4
uniform  float      uTextureScale;
2
3faef2f5128e better GLSL variable names
František Kučera <franta-hg@frantovo.cz>
parents: 0
diff changeset
     5
in       vec2       vTextureXY;
14
ceeb36fad818 transparency/alpha: simple binary transparent/opaque, no blending, just discard some fragments
František Kučera <franta-hg@frantovo.cz>
parents: 11
diff changeset
     6
out      vec4       fColor;
0
bb715a82a8f1 project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     7
18
c4384f43c739 new shader: phosphor-basic.frag
František Kučera <franta-hg@frantovo.cz>
parents: 16
diff changeset
     8
void main() {
14
ceeb36fad818 transparency/alpha: simple binary transparent/opaque, no blending, just discard some fragments
František Kučera <franta-hg@frantovo.cz>
parents: 11
diff changeset
     9
	fColor = texture(uTexture, vTextureXY).rgba;
ceeb36fad818 transparency/alpha: simple binary transparent/opaque, no blending, just discard some fragments
František Kučera <franta-hg@frantovo.cz>
parents: 11
diff changeset
    10
16
0883358bc11d new shader: soften-borders.frag
František Kučera <franta-hg@frantovo.cz>
parents: 15
diff changeset
    11
	float width = 0.01;
0883358bc11d new shader: soften-borders.frag
František Kučera <franta-hg@frantovo.cz>
parents: 15
diff changeset
    12
	fColor.a *= smoothstep(0., 0.+width, vTextureXY.x);
0883358bc11d new shader: soften-borders.frag
František Kučera <franta-hg@frantovo.cz>
parents: 15
diff changeset
    13
	fColor.a *= smoothstep(1., 1.-width, vTextureXY.x);
0883358bc11d new shader: soften-borders.frag
František Kučera <franta-hg@frantovo.cz>
parents: 15
diff changeset
    14
	fColor.a *= smoothstep(0., 0.+width, vTextureXY.y);
0883358bc11d new shader: soften-borders.frag
František Kučera <franta-hg@frantovo.cz>
parents: 15
diff changeset
    15
	fColor.a *= smoothstep(1., 1.-width, vTextureXY.y);
0
bb715a82a8f1 project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    16
}