[GEM-dev] Guassian Blur pixel shader?

james tittle tigital at mac.com
Thu Feb 16 19:04:30 CET 2006


On Feb 16, 2006, at 11:07 AM, B. Bogart wrote:
> Now that I have Gem actually compiling again on my linux machine I
> wonder if my dream of a realtime blur could be a reality with
> pixelshaders. :) Anyhow know of some extreme blurring I can apply as a
> pixelshader to a texture loaded in gem?

...sure, this should be trivial, but then why not use  
[pix_convolve]?  A gaussian blur is just a certain kind of kernal:

http://homepages.inf.ed.ac.uk/rbf/HIPR2/gsmooth.htm
http://www.ozone3d.net/tutorials/image_filtering.php

...as this last page shows, a simple gaussian blur is:
#define KERNEL_SIZE 9

// Gaussian kernel
// 1 2 1
// 2 4 2
// 1 2 1	
const float kernel[KERNEL_SIZE] = { 1.0/16.0, 2.0/16.0, 1.0/16.0,
				2.0/16.0, 4.0/16.0, 2.0/16.0,
				1.0/16.0, 2.0/16.0, 1.0/16.0 };

...and you can easily do this with [pix_convolve], which is altivec  
accelerated on osx (tho it has edge problems...)

jamie




More information about the GEM-dev mailing list