[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Adonthell-devel] To blur or not to blur

From: Kai Sterker
Subject: [Adonthell-devel] To blur or not to blur
Date: Wed, 9 Mar 2011 23:51:01 +0100

A bit of a progress update on the text rendering optimisation, and a
call for opinions.

After spending a while brooding over the code and how to change it, I
made a start with moving the Gaussian blur for the text backdrop into
the surface class, so that it would become a functionality available
for all surfaces. Certainly too slow for a real-time effect on large
surfaces, but might work out well for still images and such. Anyway, I
took the opportunity to take a closer look at the implementation
itself, as I had noticed some strange effects with it.

Got up to speed on the topic through a couple of blog posts. [1]
describes the algorithm that Ryan has implemented and [2] goes a bit
more into details.

Anyway, it appears that the kernel values Ryan picked (which I may
have even changed a bit) are not what you'd use for your regular
Gaussian blur. In fact, as the values added up are far greater than
1.0, there's the chance that color values for the individual channels
overflow. If that happens with the alpha channel, pixels that ought to
be opaque are suddenly almost completely transparent. And alpha
channel left aside, if you have very bright pixels to begin with, they
turn suddenly black. You'll notice when looking at screenshot A, which
shows the result of the current implementation. Exhibit B shows the
result of standard kernel values. I also experimented with capping the
values at 255 and stick to Ryans settings, yielding C.

Now, that's just the blur, but in reality, you'll get the text
rendered (again) on top of that. The results are E and F
(corresponding to B and C respectively). For D just run guitest.

As you can see, the improved current implementation (F) makes for a
pretty high contrast border around the text, but it's not really
suitable for a generic blur effect. The generic blur, however, results
in a subtle border, that doesn't really help in making the text easier
to read.

So the question is, what to use in the future? E or F, or something in between?

I was thinking about maybe just applying a different set of kernel
values to the alpha channel, so that the text border gets more
contrast (as the pixels should not be faded so much), while applying
the effect to ordinary surfaces would still result in a "normal" blur.

Suggestions welcome!



Attachment: A.png
Description: PNG image

Attachment: B.png
Description: PNG image

Attachment: C.png
Description: PNG image

Attachment: E.png
Description: PNG image

Attachment: F.png
Description: PNG image

reply via email to

[Prev in Thread] Current Thread [Next in Thread]