Differential D16990 Diff 60050 source/blender/compositor/realtime_compositor/shaders/compositor_glare_mix.glsl
Changeset View
Changeset View
Standalone View
Standalone View
source/blender/compositor/realtime_compositor/shaders/compositor_glare_mix.glsl
| #pragma BLENDER_REQUIRE(gpu_shader_compositor_texture_utilities.glsl) | #pragma BLENDER_REQUIRE(gpu_shader_compositor_texture_utilities.glsl) | ||||
| void main() | void main() | ||||
| { | { | ||||
| ivec2 texel = ivec2(gl_GlobalInvocationID.xy); | ivec2 texel = ivec2(gl_GlobalInvocationID.xy); | ||||
| /* Add 0.5 to evaluate the input sampler at the center of the pixel and divide by the input image | /* Add 0.5 to evaluate the input sampler at the center of the pixel and divide by the input image | ||||
| * size to get the relevant coordinates into the sampler's expected [0, 1] range. Make sure the | * size to get the relevant coordinates into the sampler's expected [0, 1] range. Make sure the | ||||
| * input color is not negative to avoid a subtractive effect when mixing the glare. */ | * input color is not negative to avoid a subtractive effect when mixing the glare. */ | ||||
| vec2 normalized_coordinates = (vec2(texel) + vec2(0.5)) / texture_size(input_tx); | vec2 normalized_coordinates = (vec2(texel) + vec2(0.5)) / vec2(texture_size(input_tx)); | ||||
| vec4 glare_color = texture(glare_tx, normalized_coordinates); | vec4 glare_color = texture(glare_tx, normalized_coordinates); | ||||
| vec4 input_color = max(vec4(0.0), texture_load(input_tx, texel)); | vec4 input_color = max(vec4(0.0), texture_load(input_tx, texel)); | ||||
| /* The mix factor is in the range [-1, 1] and linearly interpolate between the three values such | /* The mix factor is in the range [-1, 1] and linearly interpolate between the three values such | ||||
| * that: | * that: | ||||
| * 1 => Glare only. | * 1 => Glare only. | ||||
| * 0 => Input + Glare. | * 0 => Input + Glare. | ||||
| * -1 => Input only. | * -1 => Input only. | ||||
| Show All 10 Lines | |||||