-
-
Save oprypin/ba18db84e5e55ddc6d07a661062ae186 to your computer and use it in GitHub Desktop.
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
#version 130 | |
uniform sampler2D source; | |
in vec2 tex_coords; | |
out vec4 frag_color; | |
void main() { | |
ivec2 coord = ivec2(vec2(textureSize(source, 0)) * tex_coords); | |
vec3 result = vec3(0, 0, 0); | |
float a = 0; | |
vec4 px; | |
float result_malpha = 0; | |
float result_max = 0; | |
<%- (-glow_resolution..glow_resolution).each do |i| -%> | |
<%- m = gauss(i) / gauss(-glow_resolution, glow_resolution) * glow_intensity -%> | |
px = texelFetch(source, coord + ivec2(<%= horizontal ? i : 0 %>, <%= horizontal ? 0 : i %>), 0); | |
result += px.rgb * px.a * <%= m %>; | |
result_malpha += px.a * <%= m %>; | |
result_max += <%= m %>; | |
a += px.a * <%= m %>; | |
<%- end -%> | |
frag_color = vec4(result / result_malpha * result_max, a); | |
} |
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
glow_resolution = (resolution * (GlowTarget.size.x + GlowTarget.size.y) / 3000).to_i | |
glow_intensity = intensity | |
horizontal = false | |
GlowShader::Shader1.load_from_memory({{read_file("base.vert.glsl")}}, ECR.render("glow.frag.glsl.ecr")) | |
horizontal = true | |
GlowShader::Shader2.load_from_memory({{read_file("base.vert.glsl")}}, ECR.render("glow.frag.glsl.ecr")) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment