|
|
|
|
Quartz Composer Patch : Desaturate and Invert, Alpha Unchanged
/* Published by b-l-a-c-k-o-p.com Copyright (c) 2007-2009 http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode */ SAMPLE: QameraWaffleMatrix.qtzThis kernel desaturates the image and inverts it. Very useful as pre-filter for msBlackMergeAlphaFromGrey. kernel vec4 msBlackInvertRGBLeaveAlpha(sampler input_image) { vec4 pixel = sample(input_image, samplerCoord(input_image)); float average = 1.0-clamp((pixel.x+ pixel.y+ pixel.z)/3.0,0.0,1.0); pixel.r = average; pixel.g = average; pixel.b = average; return pixel; }Labels: chroma, color
By : Ms. Black Desaturate and Invert, Alpha Unchanged
Quartz Composer Patch : Color Distortion Maps, YUV
/* Published by b-l-a-c-k-o-p.com Copyright (c) 2007-2009 http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode */ SAMPLE: QameraYUVMunge.qtzThis kernel distorts the color in the image using two source image "maps". Each image map is evaluated as a greyscale value. This results in an average brightness from 0.0 ... 1.0. Using 0.5 as the center, the source pixel is adjusted in the U and V color axes by the displacements from the maps. The effect is blended back into the source pixel according to amount_normal. kernel vec4 msBlackColorDisplaceYUV(sampler image, sampler distort_u_map, sampler distort_v_map, float amount_normal) { float input_amount = clamp(amount_normal,0.0,1.0); float inverse_amount = 1.0-input_amount; const vec3 rgb_y = vec3(0.257, 0.504, 0.098); const vec3 rgb_u = vec3(-0.148, -0.291, 0.439); const vec3 rgb_v = vec3(0.439, -0.368, -0.071); const vec3 yuv_r = vec3(1.0000, 0.0000, 1.4022 ); const vec3 yuv_g = vec3( 1.0000, -0.3457, -0.7145); const vec3 yuv_b = vec3(1.0000, 1.7710, 0.0000);
vec4 pixel = sample(image, samplerCoord(image)); vec3 pel = pixel; vec3 distort_u = sample(distort_u_map, samplerCoord(distort_u_map)); vec3 distort_v = sample(distort_v_map, samplerCoord(distort_v_map));
float delta_u = clamp((distort_u.x+distort_u.y+distort_u.z)/3.0,0.0,1.0)-0.5; float delta_v = clamp((distort_v.x+distort_v.y+distort_v.z)/3.0,0.0,1.0)-0.5; vec3 pixel_yuv; pixel_yuv.x = dot(pel,rgb_y); pixel_yuv.y = dot(pel,rgb_u); pixel_yuv.z = dot(pel,rgb_v); pixel_yuv.y = clamp(pixel_yuv.y + delta_u,0.0,1.0); pixel_yuv.z = clamp(pixel_yuv.z + delta_v,0.0,1.0); pel.r = dot(pixel_yuv,yuv_r); pel.g = dot(pixel_yuv,yuv_g); pel.b = dot(pixel_yuv,yuv_b);
vec3 result = (input_amount*pel) + inverse_amount*vec3(pixel); return vec4(result.r, result.g, result.b,pixel.a); }Labels: chroma
By : Ms. Black Color Distortion Maps, YUV
Quartz Composer Patch : Sin City Style Color FX
/* Published by b-l-a-c-k-o-p.com Copyright (c) 2007-2009 http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode */ SAMPLE: QameraSinCityRed.qtzThis kernel simulates a Sin City 1-color only type camera effect. It takes a "find_color" and a "replace_color". It samples each pixel in the source image and calculates the distance (in the RGB cube) from find_color. If the source pixel is within the threshold distance from the find_color, the kernel replaces the pixel in the output image with the replace_color; otherwise, it desaturates the pixel. In the sample, we've mapped the find_color and replace_color to the same color. But if you watch Robert Rodriquez's 15min film school, you will see they used YELLOW as the find_color and RED as the replace color in many situations. Also the sample QTZ has the sensitivity on a LFO to handle different lighting conditions. kernel vec4 msBlackSinCityColorReplacement(sampler image, float input_threshold_normal, float threshold_sensitivity, __color find_color, __color replace_color) { float input_threshold_sensitivity = 2.*(1.0-clamp(threshold_sensitivity,0.0,1.0)); float input_threshold = clamp(pow(input_threshold_normal, input_threshold_sensitivity),0.0,1.0); vec3 pel_rgb = unpremultiply(sample(image, samplerCoord(image))); vec3 find_pel = vec3(find_color.r,find_color.g,find_color.b); vec4 replace_pel = vec3(replace_color.r, replace_color.g, replace_color.b); replace_pel.a = 1.0; float distance_in_rgb_cube = distance(find_pel,pel_rgb); float distance_abs = sqrt(distance_in_rgb_cube*distance_in_rgb_cube); vec4 pel_avg = (pel_rgb.r + pel_rgb.g + pel_rgb.b)/3.0; vec4 result = (distance_abs <input_threshold) ? replace_pel : pel_avg; return result; }Labels: chroma
By : Ms. Black Sin City Style Color FX
|
|
|
|
|
|