34 const int width =
image->get_width();
35 const int height =
image->get_height();
39 const float corner_weight = 0.182f;
40 const float center_weight = 1.0f - 2.0f * corner_weight;
49 x_partial_derivative += input_color * -corner_weight;
51 x_partial_derivative += input_color * -center_weight;
53 x_partial_derivative += input_color * -corner_weight;
55 x_partial_derivative += input_color * corner_weight;
57 x_partial_derivative += input_color * center_weight;
59 x_partial_derivative += input_color * corner_weight;
63 y_partial_derivative += input_color * corner_weight;
65 y_partial_derivative += input_color * center_weight;
67 y_partial_derivative += input_color * corner_weight;
69 y_partial_derivative += input_color * -corner_weight;
71 y_partial_derivative += input_color * -center_weight;
73 y_partial_derivative += input_color * -corner_weight;
76 float4 structure_tensor =
float4(
dot(x_partial_derivative, x_partial_derivative),
77 dot(x_partial_derivative, y_partial_derivative),
78 dot(x_partial_derivative, y_partial_derivative),
79 dot(y_partial_derivative, y_partial_derivative));
input_tx image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "preview_img") .compute_source("compositor_compute_preview.glsl") .do_static_compilation(true)
static blender::bke::bNodeSocketTemplate inputs[]