Using colour math with additive blending

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.
turboxray
Posts: 348
Joined: Thu Oct 31, 2019 12:56 am

Re: Using colour math with additive blending

Post by turboxray »

iNCEPTIONAL wrote: Sun Jul 10, 2022 12:50 pm Yes, that's what happens when I try to do it in Photoshop [using linear dodge as suggested]; the black parts in my image just become totally transparent. So why doesn't the black on that ghost in Mario look like it's just fully transparent rather than always looking somewhat black (at least to my eyes)?
Image
http://www.turboxraypce.org/pics/Screen ... 133333.jpg
The color from this sprite sheet rip shows a non-black color, but the game could be using whatever palette modification at that point. (You also can never trust spritesheet rips 100% )
Last edited by turboxray on Sun Jul 10, 2022 1:40 pm, edited 3 times in total.
User avatar
rainwarrior
Posts: 8734
Joined: Sun Jan 22, 2012 12:03 pm
Location: Canada
Contact:

Re: Using colour math with additive blending

Post by rainwarrior »

iNCEPTIONAL wrote: Sun Jul 10, 2022 12:50 pmSo why doesn't the black on that ghost in Mario look like it's just fully transparent rather than always looking somewhat black (at least to my eyes)?
Contrast from the bright white surrounding it? Most of the background is dark but the transparency of "black" is very clear in places it isn't:
contrast.png
contrast.png (130.78 KiB) Viewed 458 times
User avatar
Dwedit
Posts: 4924
Joined: Fri Nov 19, 2004 7:35 pm
Contact:

Re: Using colour math with additive blending

Post by Dwedit »

iNCEPTIONAL wrote: Sun Jul 10, 2022 1:29 pm
Dwedit wrote: Sun Jul 10, 2022 1:14 pm Can anyone find some actual examples of art that benefit from *variable* alpha transparency? Not just a fixed level with some opaque parts, but true varying transparency. Not just anti-aliased edges either.
I'm going to presume you mean specifically on SNES.
I meant in general, not just the SNES. You can't exactly do a google image search and get anything artistic or meaningful that makes use of variable alpha channel transparency.
Here come the fortune cookies! Here come the fortune cookies! They're wearing paper hats!
iNCEPTIONAL

Re: Using colour math with additive blending

Post by iNCEPTIONAL »

rainwarrior wrote: Sun Jul 10, 2022 1:36 pm
iNCEPTIONAL wrote: Sun Jul 10, 2022 12:50 pmSo why doesn't the black on that ghost in Mario look like it's just fully transparent rather than always looking somewhat black (at least to my eyes)?
Contrast from the bright white surrounding it? Most of the background is dark but the transparency of "black" is very clear in places it isn't:
contrast.png
Yeah, I guess it's all just set up well enough that the illusion isn't obviously broken for the most part.
iNCEPTIONAL

Re: Using colour math with additive blending

Post by iNCEPTIONAL »

Dwedit wrote: Sun Jul 10, 2022 1:38 pm
iNCEPTIONAL wrote: Sun Jul 10, 2022 1:29 pm
Dwedit wrote: Sun Jul 10, 2022 1:14 pm Can anyone find some actual examples of art that benefit from *variable* alpha transparency? Not just a fixed level with some opaque parts, but true varying transparency. Not just anti-aliased edges either.
I'm going to presume you mean specifically on SNES.
I meant in general, not just the SNES. You can't exactly do a google image search and get anything artistic or meaningful that makes use of variable alpha channel transparency.
Well, I dunno about in general (although there's surely a crap-load of examples in photos of real life and stuff like that, and presumably there will be art that tries to replicate that visual effect too), but I'll post that image of Pugsley's Scavenger Hunt again because it seems to be doing lovely variable transparency on SNES to me, using white, black and various shades of both gray on the glass and the colour of the liquid:
VariableTransparency.png
For me, this is probably the best use of additive colour blending with white for the opaque highlights and various degrees of blending over the rest of the image that I've seen in a SNES game, without the whole image just look very faint either (which is often the case with addition+half imo), and especially because it's done with a single layer and not using an additional background or any overlaid sprites to achieve the effect. For a long time I thought it must have been using two layers because I hadn't seen this effect in any other SNES game, and then I learned about the additive blending in here. Shame it seems no one else really used it as well at all, or not that I'm aware of at least. Although I'd love to see more examples of this quality if anyone has them.
Last edited by iNCEPTIONAL on Sun Jul 10, 2022 2:07 pm, edited 8 times in total.
iNCEPTIONAL

Re: Using colour math with additive blending

Post by iNCEPTIONAL »

turboxray wrote: Sun Jul 10, 2022 1:35 pm
iNCEPTIONAL wrote: Sun Jul 10, 2022 12:50 pm Yes, that's what happens when I try to do it in Photoshop [using linear dodge as suggested]; the black parts in my image just become totally transparent. So why doesn't the black on that ghost in Mario look like it's just fully transparent rather than always looking somewhat black (at least to my eyes)?
Image
http://www.turboxraypce.org/pics/Screen ... 133333.jpg
The color from this sprite sheet rip shows a non-black color, but the game could be using whatever palette modification at that point. (You also can never trust spritesheet rips 100% )
Yeah, that non-black colour is surely helping it never quite go fully transparent, which helps with the effect.
User avatar
rainwarrior
Posts: 8734
Joined: Sun Jan 22, 2012 12:03 pm
Location: Canada
Contact:

Re: Using colour math with additive blending

Post by rainwarrior »

iNCEPTIONAL wrote: Sun Jul 10, 2022 1:43 pmYeah, that non-black colour is surely helping it never quite go fully transparent, which helps with the effect.
I have no idea what turboxray's picture is from, but it's not correct. The Big Boo boss is literally using black. It's completely transparent.
booboss.png
turboxray
Posts: 348
Joined: Thu Oct 31, 2019 12:56 am

Re: Using colour math with additive blending

Post by turboxray »

rainwarrior wrote: Sun Jul 10, 2022 2:08 pm
iNCEPTIONAL wrote: Sun Jul 10, 2022 1:43 pmYeah, that non-black colour is surely helping it never quite go fully transparent, which helps with the effect.
I have no idea what turboxray's picture is from, but it's not correct. The Big Boo boss is literally using black. It's completely transparent.
booboss.png
It's from https://www.spriters-resource.com/snes/ ... et/143265/ , which I stated isn't always accurate in their rips unfortunately.
iNCEPTIONAL

Re: Using colour math with additive blending

Post by iNCEPTIONAL »

rainwarrior wrote: Sun Jul 10, 2022 2:08 pm
iNCEPTIONAL wrote: Sun Jul 10, 2022 1:43 pmYeah, that non-black colour is surely helping it never quite go fully transparent, which helps with the effect.
I have no idea what turboxray's picture is from, but it's not correct. The Big Boo boss is literally using black. It's completely transparent.
booboss.png
Wait, what does it mean that the mouth parts and stuff aren't part of the actual ghost body there? Is that and indication they are in fact overlaid sprites or something?
Last edited by iNCEPTIONAL on Sun Jul 10, 2022 2:35 pm, edited 1 time in total.
User avatar
rainwarrior
Posts: 8734
Joined: Sun Jan 22, 2012 12:03 pm
Location: Canada
Contact:

Re: Using colour math with additive blending

Post by rainwarrior »

Dwedit wrote: Sun Jul 10, 2022 1:14 pmCan anyone find some actual examples of art that benefit from *variable* alpha transparency? Not just a fixed level with some opaque parts, but true varying transparency. Not just anti-aliased edges either.
So your hypothetical is that most of the benefit of alpha blending is met by only having 3 levels of alpha? (0, 1, and one in-between blend value.)

I do agree that having only one intermediate alpha level would be pretty versatile and cover a lot of useful cases, probably the majority of them.

A common case where you might want more than one is fading something out, especially if it already has a tranlucent component. Alpha fading is impossible on the SNES... many of the Final Fantasy III/VI summon effects start with an effect that turns the party additive and fades them out, which definitely could have looked better with an alpha fade. They hide it by making the effect fast and kinda blinky.

Otherwise I can think of uses for a gradient alpha. Particle trails which fade to nothing. A creature with long transparent wings. Fog whose density fade across the space of the screen. Magical flames which dwindle toward the tips. Transition wipes and fades. UI overlays could benefit from alpha gradients.

A version of many of these suggestions could be done with additive or subtractive only, but a full alpha blend does widen the possibilities.

Not a reason applicable to SNES, but in 3D stuff I've worked on, we often wanted to avoid alpha blending for particle effects to avoid having to sort the particles back to front. Additive/subtractive blending can be done without sorting.
User avatar
rainwarrior
Posts: 8734
Joined: Sun Jan 22, 2012 12:03 pm
Location: Canada
Contact:

Re: Using colour math with additive blending

Post by rainwarrior »

iNCEPTIONAL wrote: Sun Jul 10, 2022 2:22 pmWait, what does it mean that the mouth parts and stuff aren't part of the actual ghost body there? Is that and indication they are in face overlaid sprites or something?
Yes, Big Boo is layered. If you want to see how I'd recommend taking a look in the Mesen-S sprite viewer.
iNCEPTIONAL

Re: Using colour math with additive blending

Post by iNCEPTIONAL »

rainwarrior wrote: Sun Jul 10, 2022 2:25 pm
iNCEPTIONAL wrote: Sun Jul 10, 2022 2:22 pmWait, what does it mean that the mouth parts and stuff aren't part of the actual ghost body there? Is that and indication they are in face overlaid sprites or something?
Yes, Big Boo is layered. If you want to see how I'd recommend taking a look in the Mesen-S sprite viewer.
Looking at Mesen-S won't help me specifically understand how the layering plus colour math works any better here than the image you've already provided, as I can't understand anything else from Mesen-S other than the stuff I can see visually. All the random values and stuff off to the side generally don't mean anything to me, other than the obvious ones that are self-evident, like it telling what sprite number something is or what palette it's using, etc.

So, he's layered, yet both the body and the eyes/mouth/etc fade out together, so why even bother with the layering in that case? Is that helping make his facial details more visible when the ghost is fully visible than they would be otherwise if they weren't overlaid basically? I mean, it doesn't really appear to be, as the blacks are still kind semi-transparent most of the time (although I did think they were less transparent than in my own tests with additive blending in Photoshop to be fair), but I presume that's why they used the layering here.

Anyway, how did you get to the boss that fast to check it? Do you have the game completed with the level saved and the you just went straight there? I don't have a completed and saved version of the game unfortunately. Is there a level skip feature in SMW that I didn't know about?
turboxray
Posts: 348
Joined: Thu Oct 31, 2019 12:56 am

Re: Using colour math with additive blending

Post by turboxray »

iNCEPTIONAL wrote: Sun Jul 10, 2022 2:43 pm
rainwarrior wrote: Sun Jul 10, 2022 2:25 pm
iNCEPTIONAL wrote: Sun Jul 10, 2022 2:22 pmWait, what does it mean that the mouth parts and stuff aren't part of the actual ghost body there? Is that and indication they are in face overlaid sprites or something?
Yes, Big Boo is layered. If you want to see how I'd recommend taking a look in the Mesen-S sprite viewer.
Looking at Mesen-S won't help me specifically understand how the layering plus colour math works any better here than the image you've already provided, as I can't understand anything else from Mesen-S other than the stuff I can see visually. All the random values and stuff off to the side generally don't mean anything to me, other than the obvious ones that are self-evident, like it telling what sprite number something is or what palette it's using, etc.

So, he's layered, yet both the body and the eyes/mouth/etc fade out together, so why even bother with the layering in that case? Is that helping make his facial details more visible when the ghost is fully visible than they would be otherwise if they weren't overlaid basically? I mean, it doesn't really to be, as the blacks are still kind semi-transparent most of the time (although I did think they were less transparent than in my own tests with additive blending in Photoshop to be fair), but I presume that's why they used the layering.

Anyway, how did you get to the boss that fast to check it? Do you have the game completed with the level saved and the you just went straight there? I don't have a completed and saved version of the game unfortunately.
The layering is just a form of compression. It's takes up less rom space and less vram space when you construct a meta-sprite for layers (but you do sacrifice sprite line limit for this technique). Quite a few games do this from that era. If all the sprites, of that layered meta-sprite, get assigned to main or sub screen, then they are all, after compositing, being applied to color math (assuming that's setup). It doesn't change the rendering of the color math.
iNCEPTIONAL

Re: Using colour math with additive blending

Post by iNCEPTIONAL »

turboxray wrote: Sun Jul 10, 2022 2:49 pm
iNCEPTIONAL wrote: Sun Jul 10, 2022 2:43 pm
rainwarrior wrote: Sun Jul 10, 2022 2:25 pm
Yes, Big Boo is layered. If you want to see how I'd recommend taking a look in the Mesen-S sprite viewer.
Looking at Mesen-S won't help me specifically understand how the layering plus colour math works any better here than the image you've already provided, as I can't understand anything else from Mesen-S other than the stuff I can see visually. All the random values and stuff off to the side generally don't mean anything to me, other than the obvious ones that are self-evident, like it telling what sprite number something is or what palette it's using, etc.

So, he's layered, yet both the body and the eyes/mouth/etc fade out together, so why even bother with the layering in that case? Is that helping make his facial details more visible when the ghost is fully visible than they would be otherwise if they weren't overlaid basically? I mean, it doesn't really to be, as the blacks are still kind semi-transparent most of the time (although I did think they were less transparent than in my own tests with additive blending in Photoshop to be fair), but I presume that's why they used the layering.

Anyway, how did you get to the boss that fast to check it? Do you have the game completed with the level saved and the you just went straight there? I don't have a completed and saved version of the game unfortunately.
It's takes up less rom space and less vram space when you construct a meta-sprite for layers
Now why is this?

This is not something I've considered previously. As an artist type, I thought you just had all the object tiles loaded into VRAM and used them as is once there (unless loading in new object tiles obviously), and that's how much VRAM they took up regardless of what you then did with them once they were loaded into VRAM (be it using them individually, joining them together to make larger sprites, overlapping sprites, using colour math, etc).

Looks like another thing I now need to potentially worry about--it never ends. :shock:
Last edited by iNCEPTIONAL on Sun Jul 10, 2022 3:00 pm, edited 1 time in total.
User avatar
rainwarrior
Posts: 8734
Joined: Sun Jan 22, 2012 12:03 pm
Location: Canada
Contact:

Re: Using colour math with additive blending

Post by rainwarrior »

iNCEPTIONAL wrote: Sun Jul 10, 2022 2:43 pmI can't understand anything else from Mesen-S other than the stuff I can see visually. All the random values and stuff off to the side generally don't mean anything to me
If you put the mouse over a sprite in the sprite viewer, you can see exactly what the tile looks like and it brings it to the front with a rectangle showing where it is. It's very good for seeing how a layered sprite is put together, visually.
So, he's layered, yet both the body and the eyes/mouth/etc fade out together, so why even bother with the layering in that case?
With separate pieces they can move the eyes/mouth/arm across the body without a million huge unique sprites for every position. The pieces you see cover everything it does without needing any more tile data.
Anyway, how did you get to the boss that fast to check it? Do you have the game completed with the level saved and the you just went straight there? I don't have a completed and saved version of the game unfortunately.
You might find this site useful: https://www.zophar.net/savestates/snes.html
Post Reply