Saturday, 31 May 2008

Big Buck Bunny

You may remember the Elephants Dream, the open short movie. It was developed as project Orange at the Happy Blender Institute. Now, a new team working on project Peach at the Blender Institute has published their work: an open short movie Big Buck Bunny.

At LGM, I had the pleasure of watching this great movie on a big movie theatre screen.

Elephants Dream was a technical masterpiece, showing the quality of graphics that can be accomplished with open source programs, it was somewhat lacking in the area of storytelling. While I'm guessing this dreamlike drifting to different directions was intentional at least to some degree, it just felt somehow odd to me. Maybe I just don't understand the fine art ;)

Things look quite different in Big Buck Bunny. It's still a technical masterpiece, actually they've bumped the graphics quality up a notch or two with fur, grass and all such natural phenomena. But the bigger difference is in storytelling. This movie tells a simple story in easy to follow manner, with loads of humour. Some might think that it underestimates the mental capacity of viewers, but I digress. It's nice entertainment.

Other interesting thing from Blender Institute is the project Apricot, which is creating an open source game using Blender, CrystalSpace and several other related tools. I've tried the released versions of these tools, and from what I saw at LGM, this project has made huge improvements to them. Already with the release versions, you can edit stuff like models, textures and actions between the player and scenery in Blender and export all that to the game engine. With the development version project Apricot has, it's possible to actually have the game engine running in a blender window while you can edit game data in other windows.

Friday, 30 May 2008

Fun with markers 2: Freefall

A couple days ago I bumped into a great webcomic Freefall. One thing that caught my interest was how well the artist is able to express the characters' moods, reactions etc. in small scale and with just a couple lines. I decided to try and imitate that style.

So, here's Florence Ambrose, a Bowmans Wolf and a technician, from Freefall:


While I'm not quite happy with the colours (I need more brown shades!) I think that came out quite well.

For those who've been following this webcomic, finding the strip with Florence posing like that shouldn't be a hitch.

Also, I noticed that there are some interesting colours in my palette:

Blender, Orange and Apricot. Too bad, there's no colour Peach in my palette nor in ProMarker colour range.

Thursday, 29 May 2008

Filter effects: Convolve Matrix

This is part of my filter effects tutorial series

Convolve Matrix can be used for several different effects like blurring, sharpening, edge detection and embossing. While it's a powerful tool, it can take quite some expertise to create the desired effect.

Inkscape support for Convolve Matrix filter primitive is not yet quite finished, but it can already be used for some work. The biggest problem is, the results will depend on the rendering resolution.

The idea of this filter is to apply a convolution on image. Basically, it takes certain amount of pixels around the target pixel, multiplies the colour values of each pixel by its multiplier and sums them up to form new colour value for the target pixel. There also exists common divisor and bias that will be applied after summing pixel values up.

For more through and mathematical explanations of convolutions, see Wikipedia page on Convolutions or article on Matrix convolution filters on GameDev.net.

Here's an graphical example with single target pixel and the 3×3 area surrounding it.


This same filter is specified in Inkscape Filter Effects dialog as follows:


Two special notes here: first of all, the bias is specified as 128 in the first image but as 0.5 in second image. These are actually the same thing, the first image just uses colour values in range 0–255, the second image in range 0–1.

Second, the divisor isn't actually required. I could have specified the kernel with values of -1/8 and 1.0 and left the divisor as one. The divisor just makes specifying the values easier.

Here are some examples of possible effects:

Box blur:

(notice though: usually it's better to use the Gaussian Blur filter primitive for blurring)

Motion blur:


Edge detection:


Sharpen:


Embossing:

Thursday, 22 May 2008

Rant: Curly Braces

I bumped into an writing called Java: Braces are your friend. While I can see that there are good reasons to use braces after every if statement (or after for, while, do...), the reasoning seemed a bit off.

First of all, it states that the following is allowed, but dangerous:

if (condition)
Exactly one statement to execute if condition is true
else
Exactly one statement to execute if condition is false

Well, all fine and dandy and I can see where it's aiming to. The thing is, that very form is the only form that exists. The braces just serve to gather several statements up to form a single statement, they're by no means part of 'if' syntax.

The first actual reason stated, as to why not leave the braces out, is the following situation

if (condition);
do_something();

Well, OK. I can see how one can accidentally type the semicolon after the if clause. But then again... Hello, it's 2008 calling! You won't believe what cool things our program editors nowadays have. They colour the different parts of code with different colours and you know what: they even indent your code for you! Amazing, ain't it?

if (condition);
do_something();

That certainly doesn't look like such a big error anymore. Also, if one can go and write an extra semicolon after the if clause, why couldn't this happen as well?

if (condition); {
do_something();
}

Even automatic indenting won't save you from that!

The other reason is one, I think I've seen quoted a few too many times:

if (condition)
do_something();
do_something_else();

Yes, the old case of "What if someone later on wants to add more functionality to the if block?" Well, 2008 calling again and all that. Try writing that to any even semi-decent programming editor. It becomes this:

if (condition)
do_something();
do_something_else();

Not so dangerous error anymore, either. You can clearly see that the second statement doesn't belong to the if block.

Also, it crossed my mind that both these errors become invalid code, if you have an else block after that if. That's pretty much a corner case though.

Thursday, 8 May 2008

LGM has begun

The Libre Graphics Meeting 2008 has now begun and I'm here. I arrived yesterday and it's been a bit of a crash course to life in Poland. Stuffed buses, not having a common language with shop clerks, trying to find a place where to eat and all that. But I am now here at the conference hall and I've already have met several interesting people and heard of some completely new projects.

For these new projects, it's now nearing to the end of presentation about Phatch, a patch editing application for images.

Tuesday, 6 May 2008

When PCI is not PCI

This week I bought two new peripherials for my computer: an USB 2.0 controller card and a sound card. Before you ask, yes, neither of those are integrated on the motherboard. Originally it wasn't a desktop machine but a server.

The first problem I encountered was when I tried to insert the A-Link U2P4 USB 2.0 controller in a PCI slot. It just didn't fit. The PCI connector on the controller had different keying from the PCI slot on my motherboard. While I could have made it fit using a hacksaw or something, that didn't sound like a good idea. I didn't understand the situation at all, so I looked up the PCI page from Wikipedia. What I learned was, that there are several versions of the PCI bus. The card I had in my hands was built to use 5 volt signalling and my motherboard used 3.3 volt signalling.

Further looking into different PCI versions revealed that the last version of PCI standard allowing for 5 volt only cards was deprecated already in 2004. It seems, that all new PCI cards should be able to use both 5 and 3.3 volt signalling or even 3.3 volts only.

The second problem was with the sound card, a Terratec Aureon 5.1 PCI (aka. Fun). I was able to plug that one in, but that's just about how far I got. Whenever I tried to turn the computer on, it would turn the power on for a split second and then power off. Just enough to make the fans twitch a bit. I don't really have a way to tell for sure what's the reason, but it seems that the card was short-circuiting some of the power lines, and thus causing the power supply to cut the power.

It may have been, that I just had an faulty card at my hands and if I exchanged it for a new one, it would have worked just fine. Also it may have been that the card is faulty by design and assumes that the signal voltage and +5 volt supplies are at the same voltage, thus shorting the +5V and signal voltage pins. What makes me to even suspect the latter is that I found notions that similar things have happened and that the sound card package showed a picture of a 5 volt only card. If the actual electronics hadn't been revised when the board was changed to universal type (both 5V and 3.3V) that's pretty much what would have happened. I already returned that card to the store for refund, so I don't have real evidence to back up that claim, so as I said, it could have just been one faulty card among a bunch of working cards.

Friday, 2 May 2008

Filter effects: Composite

This is part of my filter effects tutorial series.

Composite is, as the name states, an effect that can composite images together. It uses the Porter-Duff blending modes named after the writers of the paper, where it was published. For those of you with ACM Digital Library access, here's a link to the original paper: Compositing Digital Images: Porter, Duff.

The Porter-Duff blending modes are basically logical operations applied to images. For example, you can go and take an exclusive or of two images. In the original paper there was a table showing an example of each mode and some variation of that has been included in most places, where these modes are explained. Now that I have my two test subjects, Max the rat and Gina the rabbit, I can use them instead of boring triangles.


From this image, one can notice several useful relations between the different modes: over is actually the ordinary alpha compositing, out and atop are complete opposites of each other, as are in and xor.

There is a gotcha for making this kind of images: whenever you use the Background Image you need to enable it and to remember that the filter output doesn't replace the background but instead is composited over it. So, if you just created composite filter with xor mode, you'd notice that it just seems to change the compositing order. The gotcha is that the area where the both objects are atop each other is transparent and shows through the original background. So, to make these images, I actually created a solid background inside the filter to hide the original background.

There is also a sixth mode called Arithmetic. It allows you to specify the result as linear combination of input image colours. Put other way, you can specify four constants K1-K4 for the equation (result colour) = K1 * (input 1 colour) * (input 2 colour) + K2 * (input 1 colour) + K3 * (input 2 colour) + K4. With these, you can take sum of two colours (K1 = 0, K2 = 1, K3 = 1, K4 = 0), product of two colours (K1 = 1, K2 = 0, K3 = 0, K4 = 0) and plethora of other combinations. Here are a couple examples