VUEngine-Core icon indicating copy to clipboard operation
VUEngine-Core copied to clipboard

Dither-based transparency effect

Open KR155E opened this issue 5 years ago • 1 comments

I am proposing a function to set a transparency level for Entities using direct draw to BGMaps.

Depending on a given transparency level, e.g. 75 (percent), a dither pattern is chosen from a predefined set of 8x8 pixel patterns. Then, it is "applied" to all chars in the sprite. That means that all the black pixels (palette index 0) from the dither pattern tile are set to black in the sprite tile as well.

I designed the patterns in an additive way, so that all pixels that are black in one pattern are also black in all the following patterns. Therefore, going through the whole set of dither patterns one after the other, we can also create a fading effect for an individual object without the need to reload the original sprites in between steps.

553582145-Transparency

Transparency

KR155E avatar Jan 08 '21 19:01 KR155E

Came across this additive dither palette with 64 steps by Guy Perfect.

shades

KR155E avatar Jun 22 '22 15:06 KR155E