Crisp edges effect

Forum for plugin, effect and behavior programmers. Please use the Help & Support forum for help using Construct.

Post » Sat Mar 07, 2009 3:55 pm

Your shader may be just renderstates, but isn't it considerably easier to use a 1.1 effect than to use an external program to generate a distance map for every texture you want crisped up in the game? Unless there's some library or effect we can plug in to automatically generate distance maps, it's a lot of boring legwork if you want to crisp up a lot of the graphics in your game.
Scirra Founder
B
357
S
214
G
72
Posts: 22,946
Reputation: 178,228

Post » Sat Mar 07, 2009 4:57 pm

Okay, an explanation seems in order.
Alphatesting effect does not require a distance field. It can work with any alphachannel the image has. Distance field is used to enhance the image quality for high magnification levels. It is used to achieve vector-like quality for monochrome images, and also to reduce the image size (that 'No trespassing' sign used in Valve's article is as small as 64x64, and it produces an image that can be zoomed in without any limitations).

All the effects I linked to here work regardless of what kind of alphachannel the image has - distance field, or regular alpha, or just something random.

Distance field is solely a technique to improve the visual quality of the result by manipulating the alpha of the original texture. And yes, there is a way to generate it automatically. For example, this forum thread has an implementation for Unity. Also, there is a trivial way to generate a distance field from a vector shape in Xara Xtreme (I'm looking for a way to achieve the same result using freeware tools).

The bottom line is: 1) Alphatesting is just that - a render state. It doesn't care about distance fields or whatever. 2) Distance field is a technique to improve visual quality of monochrome images. Judging by the image you provided, distance field technique is superior to your Crispify effect. The downside is the need for non-trivial edittime image preprocessing.

All in all, alphatesting is a very trivial and generic thing, and it's widely used in 3d games to render, for example, tree foliage, since alphablended images don't go too well with z-buffering.

Distance field, however, is a trick to make the most out of alphatesting, and increase the resulting image quality to the level of vector graphics. It is a very niche thing, and I don't expect it to be used a lot. But, for example, Thomas Mahler's platformer likely could benefit from it.

I apologize for not making myself clear.
B
4
G
4
Posts: 65
Reputation: 1,305

Post » Sun Mar 08, 2009 11:55 pm

Okay, guys, here's a simple way of generating distance fields using Photoshop:
[url:2u0d6j00]http://www.horde3d.org/wiki/index.php5?title=Preprocessing_Technique_-_Distance_Field_Vector_Textures[/url:2u0d6j00]
Photoshop is even less freeware than Xara :), but it's more widespread and saves you the effort of tracing your raster images.
B
4
G
4
Posts: 65
Reputation: 1,305

Previous

Return to Construct engineering

Who is online

Users browsing this forum: No registered users and 1 guest