Differential D16990 Diff 60050 source/blender/compositor/realtime_compositor/shaders/compositor_glare_streaks_filter.glsl
Changeset View
Changeset View
Standalone View
Standalone View
source/blender/compositor/realtime_compositor/shaders/compositor_glare_streaks_filter.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); | ||||
| ivec2 input_size = texture_size(input_streak_tx); | ivec2 input_size = texture_size(input_streak_tx); | ||||
| /* Add 0.5 to evaluate the input sampler at the center of the pixel and divide by the image size | /* Add 0.5 to evaluate the input sampler at the center of the pixel and divide by the image size | ||||
| * to get the coordinates into the sampler's expected [0, 1] range. Similarly, transform the | * to get the coordinates into the sampler's expected [0, 1] range. Similarly, transform the | ||||
| * vector into the sampler's space by dividing by the input size. */ | * vector into the sampler's space by dividing by the input size. */ | ||||
| vec2 coordinates = (vec2(texel) + vec2(0.5)) / input_size; | vec2 coordinates = (vec2(texel) + vec2(0.5)) / vec2(input_size); | ||||
| vec2 vector = streak_vector / input_size; | vec2 vector = streak_vector / vec2(input_size); | ||||
| /* Load three equally spaced neighbours to the current pixel in the direction of the streak | /* Load three equally spaced neighbours to the current pixel in the direction of the streak | ||||
| * vector. */ | * vector. */ | ||||
| vec4 neighbours[3]; | vec4 neighbours[3]; | ||||
| neighbours[0] = texture(input_streak_tx, coordinates + vector); | neighbours[0] = texture(input_streak_tx, coordinates + vector); | ||||
| neighbours[1] = texture(input_streak_tx, coordinates + vector * 2.0); | neighbours[1] = texture(input_streak_tx, coordinates + vector * 2.0); | ||||
| neighbours[2] = texture(input_streak_tx, coordinates + vector * 3.0); | neighbours[2] = texture(input_streak_tx, coordinates + vector * 3.0); | ||||
| Show All 21 Lines | |||||