Last active
December 16, 2016 14:09
-
-
Save gam0022/24bd12699b1a363218275fe0d9c7aec7 to your computer and use it in GitHub Desktop.
dFdxとdFdyでわずか4行のお手軽エッジ検出! ref: http://qiita.com/gam0022/items/1342a91d0a6b16a3a9ba
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void mainImage( out vec4 fragColor, in vec2 fragCoord ) | |
{ | |
vec2 uv = fragCoord.xy / iResolution.xy; | |
vec4 color = texture2D(iChannel0, uv); | |
float gray = length(color.rgb); | |
fragColor = vec4(vec3(dFdy(gray)) * 5.0, 1.0); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void mainImage( out vec4 fragColor, in vec2 fragCoord ) | |
{ | |
vec2 uv = fragCoord.xy / iResolution.xy; | |
vec4 color = texture2D(iChannel0, uv); | |
float gray = length(color.rgb); | |
fragColor = vec4(vec3(step(0.07, fwidth(gray))), 1.0); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void mainImage( out vec4 fragColor, in vec2 fragCoord ) | |
{ | |
vec2 uv = fragCoord.xy / iResolution.xy; | |
vec4 color = texture2D(iChannel0, uv); | |
float gray = length(color.rgb); | |
fragColor = vec4(vec3(step(0.06, length(vec2(dFdx(gray), dFdy(gray))))), 1.0); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void mainImage( out vec4 fragColor, in vec2 fragCoord ) | |
{ | |
vec2 uv = fragCoord.xy / iResolution.xy; | |
vec4 color = texture2D(iChannel0, uv); | |
float gray = length(color.rgb); | |
fragColor = vec4(vec3(length(vec2(dFdx(gray), dFdy(gray)))), 1.0); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void mainImage( out vec4 fragColor, in vec2 fragCoord ) | |
{ | |
vec2 uv = fragCoord.xy / iResolution.xy; | |
vec4 color = texture2D(iChannel0, uv); | |
float gray = length(color.rgb); | |
fragColor = vec4(vec3(gray), 1.0); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void mainImage( out vec4 fragColor, in vec2 fragCoord ) | |
{ | |
vec2 uv = fragCoord.xy / iResolution.xy; | |
fragColor = texture2D(iChannel0, uv); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment