collapse

Author Topic: Antialias (for indexed sprites)  (Read 951 times)

0 Members and 1 Guest are viewing this topic.

Offline Arias

  • Stage Creator
  • *****
  • Posts: 355
  • Country: United States us
  • Last Login:June 18, 2023, 06:33:08 PM
Antialias (for indexed sprites)
« on: January 11, 2019, 09:46:07 PM »
A quick guide for Hi-res stuff, since 1.1 was released this method became obsolete, however, probably there are people still creating for 1.0 or lower. There was a tutorial by ExShadow iirc, but can't seem to find it, so I made one myself.

There are a couple of layering "tricks" that make easier coding hi-res stuff while using indexed images.

Let's start with this.



As you can see, the edges of this image are antialiased (they're smoothed with transparent pixels to help them blend with whatever you put behind it), this is usual in hi-res stuff, normally to code this in mugen (indexed), one would have to remove the alpha pixels leaving sharp edges & reducing the quality, but using an image with brightness at max + substractive transparency can help to reduce the time spent cleaning the alpha pixels (that's if you don't know how to create a script to do it) and improves the overall look.



So your layers should look like this:

This is the alpha that uses substractive transparency, it goes behind your sprite.


This is your normal sprite that uses additive transparency.


And in your def file lines should be like this:

[BG 0];-----------------------alpha with substractive trans.
type  = normal
spriteno = 60, 1
layerno = 1             
start = -800, 289
delta = 2, 2
trans = sub

[BG 0];----------------------your normal sprite with additive trans.
type  = normal
spriteno = 60, 0
layerno = 1               
start = -800, 289
delta = 2, 2
trans = add

This is the result:



Since it's a foreground object let's say I want to add some defocus:







Now you can notice a black edge around the barrel, this can be fixed by decreasing the brightness of the alpha OR adding another additive layer BEHIND the substractive one, like this:

[BG 0];-----------------------alpha with addalpha trans, 180,256 works fine most of the time.
type  = normal
spriteno = 60, 1
layerno = 1               
start = -800, 289
delta = 2, 2
trans = addalpha
alpha = 180,256

[BG 0];-----------------------alpha with substractive trans.
type  = normal
spriteno = 60, 1
layerno = 1             
start = -800, 289
delta = 2, 2
trans = sub

[BG 0];----------------------your normal sprite with additive trans.
type  = normal
spriteno = 60, 0
layerno = 1               
start = -800, 289
delta = 2, 2
trans = add

The result:



The downside to this method is that if your stage has too many big layers you shouldn't abuse it too much, otherwise you can cause slow down on lower-end computers, with opengl is not a problem though.

This can be used to give more opacity to hi-res effects in characters as well, ever noticed how non-bright colors become way too transparent with add-transparency?






There are a couple more things, but will post it later.
« Last Edit: January 17, 2019, 01:15:06 PM by 𝓐𝓵𝓲𝓬𝓮 »



Offline O Ilusionista

  • Since 1999 and kicking :)
  • IMT Content Architect
  • *
  • Posts: 12459
  • Country: Brazil br
  • Last Login:Today at 01:17:37 AM
  • OpenBOR & Mugen addicted
    • BMT - Brazil Mugen Team
    • Email
Re: Antialias (for indexed sprites)
« Reply #1 on: January 12, 2019, 09:16:52 PM »
Oh, this is really awesome.

Tags:
 


* IMT Facebook

Help us by Donating!

IMT Discord

Join us at our Discord! Click the image below!

* IMT Shoutbox

Sorry, this shoutbox does not exist.

* Recent Posts

* IMT Calendar

April 2024
Sun Mon Tue Wed Thu Fri Sat
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 [27]
28 29 30

SimplePortal 2.3.5 © 2008-2012, SimplePortal