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.

Advertisements

0 Responses to “CIFilter Noise”



  1. Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


Twitter

March 2009
M T W T F S S
« Jan   Apr »
 1
2345678
9101112131415
16171819202122
23242526272829
3031  

Links

Blog Stats

  • 471,292 hits

%d bloggers like this: