Wednesday, September 17, 2008

FX Filter (Part I)

Autodesk Smoke tips & tricks - FX Filter (Part I)

Ever wonder what this Fx Filter is doing ? If you are maths genius, you might able to come out with something genius.Here's the picture of a superstar before apply any magic filter numbers.

Go in the filter, and lets start with 3x3, you need to turn on the 'Enable' button first. Now you got a 3x3 matrix box.Each pixel of the picture will need to go through this matrix transformation. Note that each pixel has 1 R , 1 G , 1 B (RGB) component. The filter will put each pixel into the hot seat (the middle box), and apply some maths to it. The middle seat is the current pixel, and the other 8 boxes around is the pixel around the current pixel.

Now, look at the above matrix box, the middle seat is 1, and the surronding boxes is zero. This mean no transformation. Say if the current pixel RGB value is 100,150,200, this mean :

R100 * 1 = 100, G150 * 1 = 150, B200 * 1 = 200

This matrix formula will apply to every pixel. So, nothing is changed, no transformation.


Now if you change the 1 to 2 in the middle seat, this mean double up the value.

R100 * 2 = 200, G150 * 2 = 300, B200 *2 = 400

If you replace the middle sit number to 0.5, it will be darker then.

R100 * 0.5 = 50, so get the idea?


Now look at the below matrix, can you guess what it does ?

Say, if the hot sit pixel (current pixel) is R100, G150, B200. And the pixel just above the current pixel is R10, G20, B30. This matrix mean:

R100 * 0, G150 * 0, B200 * 0, RGB =0 : no value is taken from current pixel, but it borrow the value from the above pixel. R10*1, G20*1, B30*1 = RGB10,20,30. So the final output will be the same picture but move down 1 pixel compare to the original picture.

Say, now you give the hot sit (middle box) value 0.5

R100*0.5, G150*0.5, B200 *0.5 = RGB50,75,100 and plus the value borrow from box above:

RGB50,75,100 + RGB10,20,30 = RGB60,95,130. Get the idea ?

The whole image will be a bit blur because it has been mixed with pixel above.

Now look at this, do you know what will it does to the picture?This matrix, only take 20% from the original pixel, and it borrow 10% from each pixel around it. The final picture will be a bit blur because the pixel has been mixed with pixel around it. This is an example of Box Blur Effect. Of course, you can modify around, change the numbers, say borrow 10% from top 3 boxes, 5% from bottom 3 boxes, and 20% from left and right, and you created your own blur formula.

If you have understand this basic, we will go a bit further next time on this matrix.

Autodesk Smoke Tips & Tricks, http://mysmoke.blogspot.com/

1 comment:

Anonymous said...

Hi. Thanks a lot. That´s the first time i really understand this. I usually hate this boxes and use to think: "Who in the hell make it work?"