Does one colour ALWAYS have to be transparent?

Discussion of hardware and software development for Super NES and Super Famicom. See the SNESdev wiki for more information.

Moderator: Moderators

Forum rules
  • For making cartridges of your Super NES games, see Reproduction.
iNCEPTIONAL

Does one colour ALWAYS have to be transparent?

Post by iNCEPTIONAL »

In my Mode 0 game, I'm limited to just four colours per tile, and one of them is always just the transparent colour in the palette, but I'm curious if that transparent colour in each palette ALWAYS has to be transparent, even if you design your game such that any parts of the background that use that particular palette would always be solid tiles with no sections that need to be cut out to see any other backgrounds or even the background/backdrop colour through?

Now, I know I can technically use the background/backdrop colour as a forth colour where the transparent colour in the palette would be if there's nothing else behind the background layer other than the background/backdrop colour, but I don't mean using that; I mean truly using the forth colour in the palette as an actual visible colour, presuming I make sure not to have any missing areas on any tiles that use that palette, such that the transparent colour would actually never need to be transparent.

Is there something in code, some setting you can "tick", where you can basically say "Actually, don't make the transparent colour in this particular palette transparent at all"?

Note: You don't actually have to tell me how to specifically do it in code, as I wouldn't understand it anyway, but just if it's possible.
Myself086
Posts: 158
Joined: Sat Nov 10, 2018 2:49 pm

Re: Does one colour ALWAYS have to be transparent?

Post by Myself086 »

Index 0 of a palette is always transparent and there's nothing you can do about it. Whether you're using 2bpp, 4bpp or 8bpp.
iNCEPTIONAL

Re: Does one colour ALWAYS have to be transparent?

Post by iNCEPTIONAL »

Okily dokily then.

Cheers.
User avatar
Dwedit
Posts: 4924
Joined: Fri Nov 19, 2004 7:35 pm
Contact:

Re: Does one colour ALWAYS have to be transparent?

Post by Dwedit »

Also if there's no transparent color, why even have layers since they'd all be opaque...
Here come the fortune cookies! Here come the fortune cookies! They're wearing paper hats!
iNCEPTIONAL

Re: Does one colour ALWAYS have to be transparent?

Post by iNCEPTIONAL »

Dwedit wrote: Fri Jul 29, 2022 8:07 am Also if there's no transparent color, why even have layers since they'd all be opaque...
Well, there's eight palettes per layer, so it wouldn't be every palette or even every tile in the layer, just specific ones that I would have only used as solid tiles, and where it would have been kinda ideal to have four colours rather than three*. Other normal palettes and tiles would have been used for the areas where the parts of the background would be cut out and where you could see other layers behind them. Pretty simply really.

*Three colours gives you a base colour, highlight and shadow, but a forth colour allows you to have one than can act as a bridge between other palettes too (often black) or just allows a bit more subtle blending, so the switch to a new palette and/or tiling doesn't have to be so obvious. If you think of it like the four shades of green on Game Boy, it's pretty easy to draw almost anything with those four shades, with lots of highlight and shadow and blending that can actually look really high quality and betray the obvious limitations (even allowing effective conveying of background and foreground elements in a single layer with less contrast in the background parts than the foreground parts and so on), but as soon as you cut it down to three, it becomes much harder to work with (not impossible, obviously, but much harder and less nuanced).

I could do this with just four shades of grey (green on Game Boy)
GBC_Old DK alphabet and stuff.png
I don't think I could have managed it with just three shades.
Last edited by iNCEPTIONAL on Fri Jul 29, 2022 9:13 am, edited 6 times in total.
Drag
Posts: 1615
Joined: Mon Sep 27, 2004 2:57 pm
Contact:

Re: Does one colour ALWAYS have to be transparent?

Post by Drag »

Dwedit wrote: Fri Jul 29, 2022 8:07 am Also if there's no transparent color, why even have layers since they'd all be opaque...
No forced transparent color; if you had control over whether each palette attribute had a transparent color or not, it wouldn't render layers redundant.

Edit: Gah, got beaten to it, that just goes to show how long it takes me to write a post. :P
iNCEPTIONAL

Re: Does one colour ALWAYS have to be transparent?

Post by iNCEPTIONAL »

Drag wrote: Fri Jul 29, 2022 8:35 am
Dwedit wrote: Fri Jul 29, 2022 8:07 am Also if there's no transparent color, why even have layers since they'd all be opaque...
No forced transparent color; if you had control over whether each palette attribute had a transparent color or not, it wouldn't render layers redundant.

Edit: Gah, got beaten to it. :P
Need to get far more OCD to beat me to the punch. :P :P :P
Drag
Posts: 1615
Joined: Mon Sep 27, 2004 2:57 pm
Contact:

Re: Does one colour ALWAYS have to be transparent?

Post by Drag »

Well, specifically, I was about to go off on a tangent as to how I think it'd be nice to have full alpha blending in the palettes, like if you defined palettes with RGBA instead of being stuck with RGB + 1 transparent color. Thinking more about it, you don't really even see that in arcade games, and it's probably because it's not viable in tile-based hardware; you'd need a framebuffer.

But since the SNES doesn't work that way at all, I just trimmed everything down to one sentence. :P
turboxray
Posts: 348
Joined: Thu Oct 31, 2019 12:56 am

Re: Does one colour ALWAYS have to be transparent?

Post by turboxray »

Dwedit wrote: Fri Jul 29, 2022 8:07 am Also if there's no transparent color, why even have layers since they'd all be opaque...
Have a bit in the tilemap entry that directs if the tile in that section will use all four colors or just the three. Problem solved. Because you are going to have sections of a layer where a tile does not need to be transparent at all. It's honestly nice that the GBC had this option (just not on a per tile basis).
iNCEPTIONAL

Re: Does one colour ALWAYS have to be transparent?

Post by iNCEPTIONAL »

turboxray wrote: Fri Jul 29, 2022 1:25 pm
Dwedit wrote: Fri Jul 29, 2022 8:07 am Also if there's no transparent color, why even have layers since they'd all be opaque...
Have a bit in the tilemap entry that directs if the tile in that section will use all four colors or just the three. Problem solved. Because you are going to have sections of a layer where a tile does not need to be transparent at all. It's honestly nice that the GBC had this option (just not on a per tile basis).
Kind of a shame it's not an option on SNES.
93143
Posts: 1717
Joined: Fri Jul 04, 2014 9:31 pm

Re: Does one colour ALWAYS have to be transparent?

Post by 93143 »

There are a limited number of bits in the tilemap entry. As it stands, there are 10 bits for the tile index (allowing up to 1024 tiles per layer), 3 bits for the subpalette selector (allowing 8 subpalettes), one tile priority bit, and two flip bits (allowing horizontal and vertical tile flipping). That's the entire word; there's no more space left. Where would you sacrifice a bit? Keep in mind that with 512 tiles per layer you can no longer fill the screen with unique tiles.

...

Extra PPU registers to tag subpalettes for opaque zero colour could work too, but it would be less flexible, and hardware registers aren't free. Also, to get decent flexibility you'd need four bytes - eight bits for each of the four BG layers - and there are zero bytes free in the range $2100-$213F. There are more than enough free bits scattered over that range, but most of them are in registers that take a 10-bit or 13-bit value or something like that (e.g. scroll registers), and frankly the SNES doesn't need any more goofy bitpacking than it already has. To fit in anything more, you'd have to rejigger how the PPU MMIO works, and it's entirely possible somebody thought of this and concluded it wasn't worth it.

[[This isn't the same situation as OAM, which could easily have been expanded (I think at a significant cost in die space, so maybe not that easily) without breaking the CPU-side addressing scheme. Having a whole byte for each sprite in the top table, instead of just two bits, would allow each sprite to have 6 size bits (permitting each axis to be independently selected from 8, 16, 24, 32, 40, 48, 56, and 64 pixels) plus the 9th X bit and one other free bit, possibly a second nametable selector bit to allow 32 KB of simultaneous sprite data. The bitpacking would be somewhat less egregious too. Having to DMA 640 bytes instead of 544 wouldn't be all that big of a deal considering the improvement to the sprite system.]]

...

I suppose you could have one bit somewhere to specify that (say) the top four palettes in every BG (or every 2bpp BG, because that's where it matters) have solid colour #0. That would probably have fit, but it's by far the least flexible way to do this.
iNCEPTIONAL

Re: Does one colour ALWAYS have to be transparent?

Post by iNCEPTIONAL »

Well, I have no idea how it would have actually been accomplished in practice, but it's kinda the same as the thought exercise of how cool if would have been if Nintendo has just used a faster CPU in the SNES in the first place and also went with a 320x224 resolution instead of 256x224, both things I similarly would have appreciated. It's just some "What if's" really. Ultimately pointless dreaming though.
93143
Posts: 1717
Joined: Fri Jul 04, 2014 9:31 pm

Re: Does one colour ALWAYS have to be transparent?

Post by 93143 »

Possibly the most frustrating example of this sort of dreaming is the Nintendo 64.

We now know that a large part of the performance problem with the RAM was actually a design error in the memory controller, and that SGI found out about it before launch and was seriously considering fixing it - but presumably decided the budget and schedule costs were too high.

It's also possible that if they'd done that last design respin, they'd have realized that the additive blend mode made no sense without clamping and fixed that too. This is one of the dumber design errors I've encountered - the lack of output clamping was justifiable when the only blend mode was alpha, because alpha with clamped inputs can't overflow, but when they tacked on an additive blend mode they really should have revisited the decision. There's a reason games with lasers and holograms and coloured glow effects look weirdly dingy and toylike on N64 - it's because the blend mode best suited for such effects was virtually useless due to this oversight.

There are still people who think the PlayStation had better graphics than the Nintendo 64. If these two changes had been made, there wouldn't be. But it's too late now.
turboxray
Posts: 348
Joined: Thu Oct 31, 2019 12:56 am

Re: Does one colour ALWAYS have to be transparent?

Post by turboxray »

93143 wrote: Fri Jul 29, 2022 7:04 pm Possibly the most frustrating example of this sort of dreaming is the Nintendo 64.

We now know that a large part of the performance problem with the RAM was actually a design error in the memory controller, and that SGI found out about it before launch and was seriously considering fixing it - but presumably decided the budget and schedule costs were too high.

It's also possible that if they'd done that last design respin, they'd have realized that the additive blend mode made no sense without clamping and fixed that too. This is one of the dumber design errors I've encountered - the lack of output clamping was justifiable when the only blend mode was alpha, because alpha with clamped inputs can't overflow, but when they tacked on an additive blend mode they really should have revisited the decision. There's a reason games with lasers and holograms and coloured glow effects look weirdly dingy and toylike on N64 - it's because the blend mode best suited for such effects was virtually useless due to this oversight.

There are still people who think the PlayStation had better graphics than the Nintendo 64. If these two changes had been made, there wouldn't be. But it's too late now.
I don't know it would be better to split this off in the "other console dev" section, but I find the N64 pretty fascinating. I have not tried to code or test anything out on it yet, but I remember someone who did code for it... saying that having a music engine all in software (synth, not just streaming) actually was a waaaayy bigger performance hit than anyone had realized. IIRC, it was because the latency of the RDRAM and they fact that the music engine code running on the processor also ate up cache - so you got a pretty noticeable performance hit. That's pretty wild!
ehaliewicz
Posts: 18
Joined: Thu Oct 10, 2013 3:30 pm

Re: Does one colour ALWAYS have to be transparent?

Post by ehaliewicz »

You've probably posted 80% of the new threads on this forum in the last couple months, and most of them are very basic questions that could be answered by reading the manual rather than make people waste their time answering.

I'm not an admin on this forum, and I don't speak for them, but if I was, I would put a requirement that all posters on the SNESdev subforums have to create and submit a working snes ROM before they are allowed to post new threads, just to ensure that threads contain actually valuable discussion.
Post Reply