gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

DS development > How to use outlining and edge antialiasing

#42244 - bluescrn - Sun May 08, 2005 10:31 am

As a few people are starting to keep their knowledge to themselves due to ongoing compos, I decided I'll share what I've figured out so far....

Edge antialiasing couldn't be easier:

Code:

glEnable(GL_ANTIALIAS);


would appear to be all you need!

Outlining is a neat feature - it'll draw a single-pixel outline around a group of polygons with the same ID - for example giving a perfect outline around a cel-shaded object.

IDs range from 0-63, giving 8 groups of 8 IDs. (group 0 is IDs 0-7, group 1 is IDs 8-15, etc) Each group can have its own outline colour.

Code:

glEnable(GL_OUTLINE);
glSetOutlineColor(nIDGroup, RGB15(r,g,b));

glPolyFmt( [normal flags here] | POLY_ID(nId))

// draw polys


The outline will be drawn where a polygon edge meets a polygon with a different ID (even if in the same group).

Outlining and edge AA can be used together, but it doesn't look very good.

There's an annoying glitch with outlining - it'll always draw an outline at the edges of the screen where the polygon is clipped. Not sure if there's any way to prevent this - maybe you just have to cover it up with something...


...now to try to figure out translucency....

#42252 - YodaNC - Sun May 08, 2005 3:24 pm

have you tried glEnable(GL_OUTLINE | GL_ANTIALIAS); ?

#42253 - bluescrn - Sun May 08, 2005 3:27 pm

YodaNC wrote:
have you tried glEnable(GL_OUTLINE | GL_ANTIALIAS); ?


Yes. you get sort-of antialiased outlines.... might be useful for some things, but I didn't think it looked great. Might give a fairly nice subtle effect if used with carefully chosen colours, but it didn't really look quite right....

#42274 - BMcC - Sun May 08, 2005 9:48 pm

That's very cool, thanks for sharing!

It seems odd to me that outlining like that would come right out of the box, but I ain't arguin'.

Where was this compo announced, by the way? I'm new here.
_________________
<3,
BMcC

#42276 - bluescrn - Sun May 08, 2005 10:01 pm

BMcC wrote:
That's very cool, thanks for sharing!

It seems odd to me that outlining like that would come right out of the box, but I ain't arguin'.

Where was this compo announced, by the way? I'm new here.


There's actually 2 compos on....

one at www.gbax.com
one at neoflash.com (http://www.neoflash.com/forum/index.php?topic=127.0)


And if anyone figures out a way to get antialiased polys and non-antialiased outlined polys in the same scene, I'd be very interested to know how... I've not managed it yet, and I'm starting to think it may not be possible?

The edge AA looks amazing on flat-shaded polys - I'd like to outline some objects, but keep the rest of the scene antialiased, as it makes a huge difference, especially on flat-shaded polys

#42300 - Ethos - Mon May 09, 2005 4:19 am

bluescrn wrote:
As a few people are starting to keep their knowledge to themselves due to ongoing compos


Sooo true...I myself have given the fix for textures, but I am holding my glu Routines til after gbax...sorta a bad thing...but who can't wait a couple weeks :)
_________________
Ethos' Homepage (Demos/NDS 3D Tutorial)

#42308 - BMcC - Mon May 09, 2005 3:37 pm

Ethos wrote:
bluescrn wrote:
As a few people are starting to keep their knowledge to themselves due to ongoing compos


Sooo true...I myself have given the fix for textures, but I am holding my glu Routines til after gbax...sorta a bad thing...but who can't wait a couple weeks :)


I could die at any moment. C'mon.

EDIT: Thanks @ bluescrn for the compo information. It's probably too late for me this year, though. :(
_________________
<3,
BMcC

#70132 - bananaboy - Sat Feb 04, 2006 2:43 pm

bluescrn wrote:
There's an annoying glitch with outlining - it'll always draw an outline at the edges of the screen where the polygon is clipped. Not sure if there's any way to prevent this - maybe you just have to cover it up with something...


Sorry for bringing back an old thread, but I just thought I'd add that the Metroid Prime Hunters demo does outlining and also exhibits this glitch.

sam

#70164 - unrequited - Sat Feb 04, 2006 8:25 pm

Hey, anybody got any sceenshots or examples of this technique?
_________________
-Unrequited

#162318 - a128 - Sun Aug 31, 2008 10:19 am

bluescrn wrote:

There's an annoying glitch with outlining - it'll always draw an outline at the edges of the screen where the polygon is clipped. Not sure if there's any way to prevent this - maybe you just have to cover it up with something...

if you use the same POLY ID i.e. 2 for the clear background and you first poly which you render then you do not have this glitch. but you have to setup glClearPolyID(63); to glClearPolyID(2);

but this maybe break AA?!?!?!
http://forum.gbadev.org/viewtopic.php?t=14705

#162320 - AntonioND - Sun Aug 31, 2008 11:03 am

unrequited wrote:
Hey, anybody got any sceenshots or examples of this technique?

I made a little demo. Contols are indicated on it.

http://rapidshare.com/files/141505891/Outline.nds.html

I'll put source code if you want.

PS: AA + wireframe = OK, AA disabled + wireframe = bad?????

Edit: I didn't notice this was such an old thread. :P

#162329 - a128 - Sun Aug 31, 2008 7:30 pm

AntonioND wrote:
unrequited wrote:
Hey, anybody got any sceenshots or examples of this technique?

I made a little demo. Contols are indicated on it.

http://rapidshare.com/files/141505891/Outline.nds.html

I'll put source code if you want.


Edit: I didn't notice this was such an old thread. :P


Nice. share the source with examles...this would be great.

did you noticecd any difference into not using POLY_ID 63 for the clear background?!


Last edited by a128 on Mon Sep 01, 2008 7:46 am; edited 1 time in total

#162337 - Lino - Sun Aug 31, 2008 10:16 pm

ok thanks for the source code :)

#162343 - AntonioND - Mon Sep 01, 2008 12:06 am

Here we go!

http://rapidshare.com/files/141660038/OutlineExample.rar.html

I cleaned a bit the code and modified it a bit to be able to change clear poly ID pressing a button as well as statue poly ID.

a128, polygon ID can only be between 0 and 63. 64 = 0.