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.
iNCEPTIONAL

Re: Using colour math with additive blending

Post by iNCEPTIONAL »

Just to double check, do both backgrounds and sprites have to use the same blending mode [adjustable per scanline], such that I couldn't have say addition+half for my ship's shadow alongside a boss that only uses addition, which would mean I couldn't also say switch the blending mode half way down my boss character without it switching blending mode on the shadow if it were on one of the same scanlines too?

Is it just that you can use one type of blending and/or no blending on a scanline for everything in the game that is on that scanline--and you can change the blending method per scanline if you like--and that's basically it.

Or, can sprites use a different blending mode from the background and freely move around the screen without having to worry about what blending mode I'm using on the background?
User avatar
dougeff
Posts: 3079
Joined: Fri May 08, 2015 7:17 pm

Re: Using colour math with additive blending

Post by dougeff »

You can only do 1 kind of color math effect at a time.

If you have it set to "addition, divide by half" then every layer affected by color math uses that kind of color math effect.
nesdoug.com -- blog/tutorial on programming for the NES
iNCEPTIONAL

Re: Using colour math with additive blending

Post by iNCEPTIONAL »

dougeff wrote: Sun Jul 10, 2022 6:28 am You can only do 1 kind of color math effect at a time.

If you have it set to "addition, divide by half" then every layer affected by color math uses that kind of color math effect.
Well this is gonna make things slightly more complicated. :shock:
User avatar
dougeff
Posts: 3079
Joined: Fri May 08, 2015 7:17 pm

Re: Using colour math with additive blending

Post by dougeff »

It's only as complicated as you make it.
nesdoug.com -- blog/tutorial on programming for the NES
iNCEPTIONAL

Re: Using colour math with additive blending

Post by iNCEPTIONAL »

dougeff wrote: Sun Jul 10, 2022 8:23 am It's only as complicated as you make it.
True. But if you want to do some cool stuff with SNES, stuff beyond the obvious/typical Mode 1 three layers and maybe some addition+half transparency that most games used, it certainly doesn't come easily.
iNCEPTIONAL

Re: Using colour math with additive blending

Post by iNCEPTIONAL »

What blending modes and/or setting in Photoshop give me the equivalents of addition, addition+half, subtraction, subtraction+half, as they would basically look on SNES?

And I need to invert the image if I'm going to use subtraction or subtraction+half and still want the colours to look the right way around, correct?

Note: I'm using ancient Photoshop 7, in case that's relevant because the modern version has changed blending or something.
Last edited by iNCEPTIONAL on Sun Jul 10, 2022 10:33 am, edited 1 time in total.
creaothceann
Posts: 611
Joined: Mon Jan 23, 2006 7:47 am
Location: Germany
Contact:

Re: Using colour math with additive blending

Post by creaothceann »

iNCEPTIONAL wrote: Sun Jul 10, 2022 4:18 am Just to double check, do both backgrounds and sprites have to use the same blending mode
You don't do color math with backgrounds/sprites. You select which layers appear on the Mainscreen and which appear on the Subscreen, then you select if and how the Subscreen is added to or subtracted from which Mainscreen layers. The color math settings can probably only be changed during blanking.
My current setup:
Super Famicom ("2/1/3" SNS-CPU-GPM-02) → SCART → OSSC → StarTech USB3HDCAP → AmaRecTV 3.10
User avatar
dougeff
Posts: 3079
Joined: Fri May 08, 2015 7:17 pm

Re: Using colour math with additive blending

Post by dougeff »

I think I did the "half" wrong, so, someone else answer that.

I actually used GIMP which has add and subtract layer options.
nesdoug.com -- blog/tutorial on programming for the NES
iNCEPTIONAL

Re: Using colour math with additive blending

Post by iNCEPTIONAL »

creaothceann wrote: Sun Jul 10, 2022 10:31 am
iNCEPTIONAL wrote: Sun Jul 10, 2022 4:18 am Just to double check, do both backgrounds and sprites have to use the same blending mode
You don't do color math with backgrounds/sprites. You select which layers appear on the Mainscreen and which appear on the Subscreen, then you select if and how the Subscreen is added to or subtracted from which Mainscreen layers. The color math settings can probably only be changed during blanking.
So is this just the background layer with the smoke and the ghost sprites [using palettes 4-7] on the Subscreen using presumably addition+half blending, and it all just works visually and even creates the illusion of different overlapping semi-transparent elements, with the ghosts additionally doing something that makes it look like they are getting brighter and darker at times (changing the colour palette?): https://youtu.be/5WxHLB0Kc10?t=8400

And is this boss just addition+half (or maybe just addition) with some colour palette changes to affect how transparent he appears at different times: https://youtu.be/R4fVK3egLw4?t=132
User avatar
rainwarrior
Posts: 8732
Joined: Sun Jan 22, 2012 12:03 pm
Location: Canada
Contact:

Re: Using colour math with additive blending

Post by rainwarrior »

Both of those are just addition, no halving.

Addition can do a palette fade like you're seeing.

Add + Half is mostly limited to a 50% blend.
iNCEPTIONAL

Re: Using colour math with additive blending

Post by iNCEPTIONAL »

rainwarrior wrote: Sun Jul 10, 2022 11:25 am Both of those are just addition, no halving.

Addition can do a palette fade like you're seeing.

Add + Half is mostly limited to a 50% blend.
Ah, okay.

So, presumably the smoke and ghosts on the Prehistoric Man level must be drawn actually pretty dark then, so they don't end looking too bright/overexposed?

And with the ghost, how come the black areas aren't just completely transparent (or don't appear to be) like when I try to do the same thing in Photoshop using either Lighten or Linear Dodge as suggested? It doesn't look like those black parts on the ghost are using overlapping sprites as they fade in and out of transparency too. Are they doing something there to keep the black lines on the ghost looking relatively black regardless of what part of the background he passes over? Or is that just a wee bit of optical illusion going on?
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 11:31 am
rainwarrior wrote: Sun Jul 10, 2022 11:25 am Both of those are just addition, no halving.

Addition can do a palette fade like you're seeing.

Add + Half is mostly limited to a 50% blend.
Ah, okay.

So, presumably the smoke and ghosts on the Prehistoric Man level must be drawn actually pretty dark then, so they don't end looking too bright/overexposed?

And with the ghost, how come the black areas aren't just completely transparent (or don't appear to be) like when I try to do the same thing in Photoshop using either Lighten or Linear Dodge as suggested? It doesn't look like those black parts on the ghost are using overlapping sprites as they fade in and out of transparency too. Are they doing something there to keep the black lines on the ghost looking relatively black regardless of what part of the background he passes over? Or is that just a wee bit of optical illusion going on?
If it's additive, and the color added to the other color is black ( 0/0/0 ), then you've basically added nothing. It becomes complete see through.
iNCEPTIONAL

Re: Using colour math with additive blending

Post by iNCEPTIONAL »

turboxray wrote: Sun Jul 10, 2022 12:38 pm
iNCEPTIONAL wrote: Sun Jul 10, 2022 11:31 am
rainwarrior wrote: Sun Jul 10, 2022 11:25 am Both of those are just addition, no halving.

Addition can do a palette fade like you're seeing.

Add + Half is mostly limited to a 50% blend.
Ah, okay.

So, presumably the smoke and ghosts on the Prehistoric Man level must be drawn actually pretty dark then, so they don't end looking too bright/overexposed?

And with the ghost, how come the black areas aren't just completely transparent (or don't appear to be) like when I try to do the same thing in Photoshop using either Lighten or Linear Dodge as suggested? It doesn't look like those black parts on the ghost are using overlapping sprites as they fade in and out of transparency too. Are they doing something there to keep the black lines on the ghost looking relatively black regardless of what part of the background he passes over? Or is that just a wee bit of optical illusion going on?
If it's additive, and the color added to the other color is black ( 0/0/0 ), then you've basically added nothing. It becomes complete see through.
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)?
Last edited by iNCEPTIONAL on Sun Jul 10, 2022 1:28 pm, edited 1 time in total.
User avatar
Dwedit
Posts: 4924
Joined: Fri Nov 19, 2004 7:35 pm
Contact:

Re: Using colour math with additive blending

Post by Dwedit »

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.
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 »

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.

Isn't that exactly what the glass beakers and test tubes with liquid in them in Pugsley's Scavenger Hunt do, where some parts of the glass are more or less transparent due to the use of white, various shades of grey and various shades of the colour for the liquid, and black sections?
VariableTransparency.png
Last edited by iNCEPTIONAL on Sun Jul 10, 2022 1:38 pm, edited 1 time in total.
Post Reply