Created
October 28, 2019 18:11
-
-
Save jimmyjonezz/a0c508e6cb60cdbaef7795876d49f716 to your computer and use it in GitHub Desktop.
https://docs.godotengine.org/en/3.1/tutorials/viewports/custom_postprocessing.html (https://en.wikipedia.org/wiki/Sobel_operator)
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
shader_type canvas_item; | |
void fragment() { | |
vec3 col = -8.0 * texture(SCREEN_TEXTURE, SCREEN_UV).xyz; | |
col += texture(SCREEN_TEXTURE, SCREEN_UV + vec2(0.0, SCREEN_PIXEL_SIZE.y)).xyz; | |
col += texture(SCREEN_TEXTURE, SCREEN_UV + vec2(0.0, -SCREEN_PIXEL_SIZE.y)).xyz; | |
col += texture(SCREEN_TEXTURE, SCREEN_UV + vec2(SCREEN_PIXEL_SIZE.x, 0.0)).xyz; | |
col += texture(SCREEN_TEXTURE, SCREEN_UV + vec2(-SCREEN_PIXEL_SIZE.x, 0.0)).xyz; | |
col += texture(SCREEN_TEXTURE, SCREEN_UV + SCREEN_PIXEL_SIZE.xy).xyz; | |
col += texture(SCREEN_TEXTURE, SCREEN_UV - SCREEN_PIXEL_SIZE.xy).xyz; | |
col += texture(SCREEN_TEXTURE, SCREEN_UV + vec2(-SCREEN_PIXEL_SIZE.x, SCREEN_PIXEL_SIZE.y)).xyz; | |
col += texture(SCREEN_TEXTURE, SCREEN_UV + vec2(SCREEN_PIXEL_SIZE.x, -SCREEN_PIXEL_SIZE.y)).xyz; | |
COLOR.xyz = col; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment