PDA

View Full Version : "No Background Antialiasing" Button?



bunkai
08-25-2005, 04:05 AM
Hello all,

Often a 3D application is used to render game sprites for 16 - graphics, like for console games or Pocket PC games. The second is my case. I want to have my objects nice an antialiased, but still I want to have sharp edges.

My question is, if there is a way how to keep a rendered object Antialiased inside but still not to have any backgound antialiasing? Both, Maya and 3DSMax have a button that simply turns off Background Antialiasing.

Imagine that I take rendered and Antialiased sprite and use it in my game. When the sprite hits game backgound of different collor then it was rendered on, then it always has undesirabled contours.

It is possible to trim the contours partially in photoshop, but they will never be removed completely, or too much of the sprite itself will be lost.

Is there any chance, that a "No BB Antialiasing Button" would be added into rendering settings please?

Thank you,
Regards,
Rene.

operation
08-25-2005, 06:34 AM
hi sorry for my short reponse, but yes it's possible ...

there is a filter to put in compositing panel ...
in past it was a external script done by someone... it's included in LW now ...

Sorry I have to go back to work but search in the doc , if I have time I will take a look to tell you wich one to use ...

Cheers.
Operation
Mourad K.

BeeVee
08-25-2005, 08:53 AM
Sprite Edger in Image Filters on the Effects > Processing panel

bunkai
08-25-2005, 09:11 AM
Hello,

Thank you both for response. I have heard of SpriteEdger plug-in and earlier I looked at it. It was several yers ago. What I figured out was, that Sprite Edger just trims antialiased part, and/or replaces that part by a single collor, if required.

However, this way, the shape of the object is modified, and often id makes difference on small sprite. Well, I hope that I am correct with these statements.

How good it would be to have a possibility not to trim the already small sprite, just to turn off the antialiasing.

If I write to NewTek, do you think that they would listen to me? Or, do NewTek people ocassionally look at these messages, and find inspiration for future modifications?

Lightwolf
08-25-2005, 09:42 AM
Actually, sprite edger doesn't trim the edge.
Here is what it does (assuming you render on black, which is what you should do anyhow).
Let's assume you have an orange edge pixel with RGB 255,128,0

Due to the AA at the edge we will assume it will be 50% transparent, which results in an RGBA of 255,128,0,128
Now, since LW post-multiplies images what you actually see is 128,64,0,128, i.e. the colour multiplied by the alpha (50%) plus the background (black, 0,0,0) multiplied by the remaining alpha (i.e. 100%-50%). The backround being 0,0,0 doesn't affect the image though.

This is where sprite edger comes in. It looks for all pixels with an alpha of less than 255 (i.e. anything with a bit of transparency in the alpha) and multiplies the RGB by the inverse of the alpha, effectively restoring the original colour.

In our case:
128,64,0,128
The inverse of the alpha is 1 / 50% = 2
128,64,0,128 * 2 = 255,128,0,255
Which is the original orange that you wanted.

I hope this helps a bit.

Cheers,
Mike

Mebek
08-25-2005, 09:50 AM
From your mathematics, it looks like it also ends up altering the alpha mask (original orange had an alpha value of 128 and the new pixel had an alpha of 255).

EDIT - okay I just tested the plugin and it looks like it keeps the alpha intact indeed. This is great for video compositing as well. In After Effects' terminology, this would be like converting a premultiplied image with Alpha to a Straight or Unmatted Alpha - something that I've always wanted in Lightwave!

bunkai
08-25-2005, 09:57 AM
LightWolf,

Thank you very much for your exhaustive explanation. Now I can be sure, that I will get exactly the image with removed antialiasing.. assumig you are correct. :-)

I will look again at it, and I will very probably start using it. It would be fine I can program some ver fast routine where alpha layer could be used, on ever game sprite on PPC, however evertyhing I did, was too heavy for its processor. (www.cutn.sk/reno/game)

thank you so far and I wish you delightful day. Anyway, because you are good in graphics calculations, dont you have any idea about some very effective sprite display routine, even with alpha blending, do keep the edges sharp?

Have a nice day,
Rene.

Lightwolf
08-25-2005, 09:59 AM
From your mathematics, it looks like it also ends up altering the alpha mask (original orange had an alpha value of 128 and the new pixel had an alpha of 255).

EDIT - okay I just tested the plugin and it looks like it keeps the alpha intact indeed. This is great for video compositing as well.
Well, for video it should, for games it should set the Alpha to 255 ... I'm not sure if there is an option for that though... I haven't looked at it for ages I have to admit ....

Cheers,
Mike

Lightwolf
08-25-2005, 10:00 AM
Anyway, because you are good in graphics calculations, dont you have any idea about some very effective sprite display routine, even with alpha blending, do keep the edges sharp?

Lol, I'm not that good, and certainly not fast enough for a realtime engine ;)
Alpha blending is pretty standard stuff though... have you thought about some open source components, or even openGL?

Cheers,
Mike

bunkai
08-25-2005, 03:29 PM
Well, on Pocket PC there are no Open GL libraries. Everything must be develop by myself.

Well, anyway, thank you for your help, and time to respond.

Have a nice day,
Rene

Lightwolf
08-25-2005, 04:15 PM
Well, on Pocket PC there are no Open GL libraries. Everything must be develop by myself.

Hi Rene,
have you looked at http://www.libsdl.org/ , they're supposed to at least have rudimentary support for windows CE, which should include blitting routines for sprites.
I didn't verify it myself though...
Well, I found this as well: http://pocketfrog.droneship.com/
Cheers,
Mike

WizCraker
08-26-2005, 12:48 AM
Graphics in Windows CE 5.0 [current version] (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wcemultimedia5/html/wce50congraphicstechnologies.asp)

Direct3D Mobil [a graphics solution built on DirectX] (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wcemultimedia5/html/wce50conDirect3DMobileProgramming.asp)

Managed Direct3D Mobile Samples (http://msdn2.microsoft.com/library/ms181014(en-us,vs.80).aspx)

Direct3D Mobile UltimateGMan Game Sample (http://msdn2.microsoft.com/library/ms180969(en-us,vs.80).aspx)

neXe DirectX Resource (http://nexe.gamedev.net/directKnowledge/)

that should get you started assuming you are developing for the most current version of the OS for the Pocket PC

bunkai
08-26-2005, 01:26 AM
Ah WizCracker,

Thank you very much for information. I did not know about Windows Mobile 5, because I have installed Windows Mobile 2003.

However, I am going to see if I can reinstall my OS, and will start using Windows Mobile Direct 3D immediatelly. Hopefully, it will have fast alpha blending routines.

Thank you for really good information. Thank you LightWolf too.

Regards,
Rene.