13
May
08

tb xyMixPixellate

Another in a seemingly endless series of minor variations on the pixellation/glitch theme.

In this version, the image is divided into tiles of variable size. Each tile can be ‘zoomed’ until it becomes a single solid colour (giving a standard pixellation ‘mosaic’ effect). Optionally, the amount of zoom for each tile can be controlled by the luminosity of the centre pixel of each tile.

Leopard-only.

See Box.net widget at bottom of right sidebar for download.

Also now available from Memo’s site.


/*
A simple pixellation effect with mix controls
toneburst 2008
*/

kernel vec4 tb_xyMixPixellate(sampler Image, vec2 Size, vec2 Mix)
{
	vec2 xy = samplerCoord(Image);

	vec2 xyPix = floor(xy / Size) * Size;
	xyPix += 0.5 * Size;

	Mix = Mix * 2.0;
	vec2 samplePos = mix(xy,xyPix,Mix);

	// Output
	return sample(Image, samplerTransform(Image, samplePos));
}

and this is the JavaScript from the bottom panel of the CIFilter


function __image main(__image Image, __vec2 Size, __vec2 Mix) {

     // Image dimensions
      __vec2 dims = new Vec(Image.extent.width, Image.extent.height);
     // Size of cells (X and Y)
      __vec2 pixSize = new Vec(dims.x / Math.ceil(dims.x * Size.x), dims.y / Math.ceil(dims.y * Size.y));

      // Call kernel code and return image
      return tb_xyMixPixellate.apply(Image.definition, null, Image, pixSize, Mix);
}

0 Responses to “tb xyMixPixellate”


  1. No Comments

Leave a Reply




 

May 2008
M T W T F S S
« Apr   Jun »
 1234
567891011
12131415161718
19202122232425
262728293031  

Categories

Links

Blog Stats

  • 28,388 hits