diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-08-08 22:10:13 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-08-08 22:10:13 +0400 |
commit | 5019cd179f39ee8f80829bb0d6895e494a66ffa2 (patch) | |
tree | 38727d9646468394de783fd49554873495248638 /source/blender/compositor/operations/COM_OpenCLKernels.cl.h | |
parent | a401971cf88e3acadb04243929822da6fcf03174 (diff) |
add threshold blending to opencl too.
Diffstat (limited to 'source/blender/compositor/operations/COM_OpenCLKernels.cl.h')
-rw-r--r-- | source/blender/compositor/operations/COM_OpenCLKernels.cl.h | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/source/blender/compositor/operations/COM_OpenCLKernels.cl.h b/source/blender/compositor/operations/COM_OpenCLKernels.cl.h index e7de861710f..e72ed5bf755 100644 --- a/source/blender/compositor/operations/COM_OpenCLKernels.cl.h +++ b/source/blender/compositor/operations/COM_OpenCLKernels.cl.h @@ -103,6 +103,7 @@ const char * clkernelstoh_COM_OpenCLKernels_cl = "/*\n" \ " int2 inputCoordinate = realCoordinate - offsetInput;\n" \ " float size_center = read_imagef(inputSize, SAMPLER_NEAREST, inputCoordinate).s0;\n" \ " color_accum = read_imagef(inputImage, SAMPLER_NEAREST, inputCoordinate);\n" \ +" readColor = color_accum;\n" \ "\n" \ " if (size_center > threshold) {\n" \ " for (int ny = miny; ny < maxy; ny += step) {\n" \ @@ -127,10 +128,20 @@ const char * clkernelstoh_COM_OpenCLKernels_cl = "/*\n" \ " }\n" \ " }\n" \ " }\n" \ -" }\n" \ "\n" \ -" color = color_accum * (1.0f / multiplier_accum);\n" \ -" write_imagef(output, coords, color);\n" \ +" color = color_accum * (1.0f / multiplier_accum);\n" \ +"\n" \ +" /* blend in out values over the threshold, otherwise we get sharp, ugly transitions */\n" \ +" if ((size_center > threshold) &&\n" \ +" (size_center < threshold * 2.0f))\n" \ +" {\n" \ +" /* factor from 0-1 */\n" \ +" float fac = (size_center - threshold) / threshold;\n" \ +" color = (readColor * (1.0f - fac)) + (color * fac);\n" \ +" }\n" \ +"\n" \ +" write_imagef(output, coords, color);\n" \ +" }\n" \ "}\n" \ "\n" \ "\n" \ |