MasDennis/Rajawali — pull request #383 by AndrewJo (2013-02-12 09:53:47+00:00)
Title: BlurFilter added

Added a directional gaussian blur filter that can be used for two-pass blurring.

I figured blur filter is one of the most widely used post processing effect and others could benefit from my code as well as make improvements.

Blur filter is also the staple of many other advanced post processing effects such as depth of field, bloom/glow, soft shadows, etc. so adding the filter into the framework seemed logical.

Two-pass vs One-pass
---------------------------------
This is a classic case of O(n) vs. O(n^2) we learned in that dreaded algorithms lectures in college. Two-pass blurring is much faster than one-pass blur as sampling n pixels twice is much faster than sampling n^2 pixels once.

Example
-------------
Two-pass blur:
```java
public void initScene() {
super.initScene();

/* Set up the scene here */
...

/* Perform a two-pass 3-step gaussian blur
* First two arguments correspond to width and height
* Third argument is number of sampling steps from 0 to 10.
* Fourth argument is blur scale to be used
* Fifth argument corresponds to blur strength
* Sixth argument is the orientation of the blur
*/
addPostProcessingFilter(new BlurFilter(width, height, 3, 3.0f, 0.5f, BlurFilter.Orientation.HORIZONTAL));
addPostProcessingFilter(new BlurFilter(width, height, 3, 3.0f, 0.5f, BlurFilter.Orientation.VERTICAL));
}
```

Without Blur
![solarsystem_earth_screenshot](https://f.cloud.github.com/assets/3170805/148260/d699b0c4-74f8-11e2-81e9-05dc585f70d3.png)
With Blur
![blur](https://f.cloud.github.com/assets/3170805/148264/e9c21efc-74f8-11e2-9835-2aaa9db88dbe.png)