text and transparency

SGDK only sub forum

Moderator: Stef

Post Reply
Top l'âne
Interested
Posts: 20
Joined: Tue May 03, 2022 12:13 pm

text and transparency

Post by Top l'âne » Fri Aug 12, 2022 9:22 am

While making my previous demo I faced an unexpected issue of priority display with text.

Here, text and hud are both set on BG_A, but the box of the text smashes the tiles instead of transparency:

Image


In this other case, text and tiles are set on BG_B, and the box of text do not show transparency:


Image


Many attempts, modifying priority effects of tiles and text cause the primary objective was to scroll the hud and text with it.
At last I write text on BG_A, but only when no tile is shared with on this plan.


What did I miss?

AmateurSegaDev
Interested
Posts: 14
Joined: Sun Feb 27, 2022 3:27 am

Re: text and transparency

Post by AmateurSegaDev » Tue Aug 23, 2022 2:44 am

Can you paste your code?

Chilly Willy
Very interested
Posts: 2913
Joined: Fri Aug 17, 2007 9:33 pm

Re: text and transparency

Post by Chilly Willy » Tue Aug 23, 2022 2:57 pm

Not saying this is the problem, but remember the priority chain: S > A > B > G. For B to show up over A, it must have its priority bit set. If A has its priority bit set, B will never show over it. Another thing to remember is that transparent pixels MUST be 0. I've seen tilesets designed to use another value as transparent. Those will not be transparent on the MD. Finally, remember that the VDP sets which palette bank value 0 is the background. The MD doesn't have 64 colors (ignoring shadow/hilite), it has 60 + 1 background that can be chosen on the fly from four different values.

Top l'âne
Interested
Posts: 20
Joined: Tue May 03, 2022 12:13 pm

Re: text and transparency

Post by Top l'âne » Tue Aug 23, 2022 3:34 pm

@amateurSC:
I only use the VDP_drawTextEx();
I use the last color from 4 existing palettes in the demo. (bricks, sprites...).


I have not worked on this problem yet but I have noticed lately that my graphic tool (mtpaint), saves images with a -1 as defaut transparency state.
I considered this could be a valuable clue.

And you, Chilly, give me the feeling I might be right.
I will start a brand new demo very soon and I will take care with the images' savings.

Colors and palettes use were pretty complicated processes to me but this stuff becomes brighter those days.
I'm fine with the idea of 60+1 colors.
When I create/set a 16 colors palette, I always consider the 0 as the transparency.

I feel quite comfortable as well with the priority chain. I'll be glad to show this very soon... Next release on september!

Thanks guys. :D

Post Reply