Archive for March 11th, 2009

11
Mar
09

Chladni Patterns

OK, I promised more info on these screenshots:

They’re based on formulae found here for sound wave propagation through vibrating membranes. In fact, though, the QTZ I produced doesn’t really model natural phenomena, as I’m using a version of the formula for a rectangular plate, but driven by a polar coordinate system. I’ve also added an adjustable exponential multiplier to the rho coordinate (which represents each pixel’s distance from the centre of the texture), to make it look more interesting.

EDIT:

Finally managed to get a working video-grab of the effect in action.

11
Mar
09

CIFilter Noise

Updated

Here’s some simple CIFilter JS to generate a random noise texture.

function __image main(__number Scale, __number _dummy)
{	
	// Create noise texture
	var randomImage = Filter.CIRandomGenerator();
	
	// Crop noise texture
	var rect = new Vec(Math.floor(Math.random() * 10000), Math.floor(Math.random() * 10000), Scale, Scale);
	randomImage = Filter.CICrop(randomImage, rect);
	
	// Call kernel function and return result
	return randomImage;
}

It’s the same as using Random and Crop patches, but all in one CIFilter patch. Like the other method, however, it creates a texture with an annoying 1-pixel black border. Not sure how to fix this issue. Also, because the CIFilter patch is only evaluated when the inputs change, you need to feed something like a Patch Time into the ‘_dummy’ input, or the image won’t change. You could probably exploit this fact to produce static noise that changed on a trigger event.

Like the constant color technique in the previous post, I don’t know if this is going to be genuinely useful to anyone. I’ll probably use it myself, if only to keep patch-cord spaghetti at bay.

Note also that the JS code doesn’t actually apply a filter kernel, but you need to have a working kernel function in the top pane of the CIFilter patch.

11
Mar
09

Generating Base texture Inside CIFilter

Here’s a little JavaScript code-snippet to generate a base texture to pass to a CoreImage Kernel function, as a base for 2D pattern effects, for example:

function __image main(__vec2 TexSize, __color BaseColor)
{	
	// Create color-block
	var colorBlock = Filter.CIConstantColorGenerator(BaseColor);
	
	// Crop color-block
	var rect = new Vec(0, 0, TexSize.x, TexSize.y);
	colorBlock = Filter.CICrop(colorBlock, rect);
	
	// Call kernel function and return result
	return myKernelFunction.apply(colorBlock.definition, null, colorBlock);
}

Inputs allow texture-size and base colour to be set.

I like the fact that it allows for the creation of a self-contained pattern-generating CIFilter patch. I used the technique with the Plasmoids QTZ.




March 2009
M T W T F S S
 1
2345678
9101112131415
16171819202122
23242526272829
3031  

Links

Blog Stats

  • 502,151 hits