It is currently Sun Oct 21, 2018 5:37 am

All times are UTC - 7 hours



Forum rules





Post new topic Reply to topic  [ 47 posts ]  Go to page 1, 2, 3, 4  Next
Author Message
 Post subject: Max colour output
PostPosted: Sat Sep 22, 2018 2:18 pm 
Offline

Joined: Sat Apr 07, 2018 7:39 pm
Posts: 12
Hey guys.

I've been trying to think about what the limits are on colours on the snes, and I couldn't quite work it out.
Using just colour math, and possibly hdma, what is the limit on the colours per frame on snes?
I worked out maybe 4096 colours was possible, but can you hit the 32768 colour limit?

Thanks,
Molive.


Top
 Profile  
 
 Post subject: Re: Max colour output
PostPosted: Sat Sep 22, 2018 2:26 pm 
Offline

Joined: Sun Apr 13, 2008 11:12 am
Posts: 7676
Location: Seattle
GoodSNES has a "32768 Color Demo by Joshua Cain".

Clever abuse probably could invent a few more colors using the display brightness control, since reportedly that has its own 4 bit DAC that multiplies the RGB channels' 5 bit DACs in analog.


Top
 Profile  
 
 Post subject: Re: Max colour output
PostPosted: Sat Sep 22, 2018 2:46 pm 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 20679
Location: NE Indiana, USA (NTSC)
Combining color math with pseudo-hires can generate (2*sub+main+COLDATA)/4 and (3*sub+main)/4, in theory allowing for even more intermediate colors.


Top
 Profile  
 
 Post subject: Re: Max colour output
PostPosted: Sat Sep 22, 2018 2:52 pm 
Offline

Joined: Sat Apr 07, 2018 7:39 pm
Posts: 12
That 32768 colour demo seems to use hdma to force the same R colour per scanline, which means that it can't be used for arbitrary images :/
Is there other ways?


Top
 Profile  
 
 Post subject: Re: Max colour output
PostPosted: Sat Sep 22, 2018 3:00 pm 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 20679
Location: NE Indiana, USA (NTSC)
The biggest limit you'll hit in full screen is VRAM. An 8 bit per pixel 256x224 pixel image with all unique tiles already takes 58K of the 64K of VRAM: 56K for the tiles and 2K for the map.

If you letterbox to 256x160, you can go 12 bits per pixel (4 bits per channel) by using color math in mode 3 to add an 8bpp "direct color" image (3 bits red, 3 bits green, 2 bits blue) with a 4bpp low bits image (1 bit red, 1 bit green, 2 bits blue). This takes 60K for the tiles and 4K for the map, leaving nothing for sprites. You can use software sprites. If you want a larger image or some VRAM for hardware sprite tiles (which are limited to 4bpp), you can repeat tiles in the tilemap.


Top
 Profile  
 
 Post subject: Re: Max colour output
PostPosted: Sat Sep 22, 2018 3:08 pm 
Offline

Joined: Sun Apr 13, 2008 11:12 am
Posts: 7676
Location: Seattle
There's the DMA hack that 93143 invented, allowing displaying a 64x224x15bpp image (4x1 pixel blocks).

Basically the SNES analog of the equivalent Genesis DMA hack (that displays 160x224x9bpp).

But honestly, you're going to get perfectly adequate results with just an 8bpp paletted image; you might need to hunt down a good quantizer. (Bisqwit's animmerger includes a wide variety)


Top
 Profile  
 
 Post subject: Re: Max colour output
PostPosted: Sat Sep 22, 2018 3:13 pm 
Offline

Joined: Wed May 19, 2010 6:12 pm
Posts: 2760
Normal circumstances it's 256 colors. It can be up to 32768 colors if using transparency, or HDMA tricks.


Top
 Profile  
 
 Post subject: Re: Max colour output
PostPosted: Sat Sep 22, 2018 4:53 pm 
Offline
User avatar

Joined: Fri May 08, 2015 7:17 pm
Posts: 2308
Location: DIGDUG
I feel like with color math, you should be able to push an additional 3 bits of color variation onto a max palette of 256.

256x2x2x2 = 2048.

Then adjust the screen brightness 16 times a frame.

2048x16=32768...

actually, screen brightness zero = black so... 15

2048x15+black=30721

_________________
nesdoug.com -- blog/tutorial on programming for the NES


Last edited by dougeff on Sat Sep 22, 2018 5:02 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: Max colour output
PostPosted: Sat Sep 22, 2018 5:01 pm 
Offline

Joined: Sun Apr 13, 2008 11:12 am
Posts: 7676
Location: Seattle
That's basically the method that tepples pointed out. Start out with a R3G3B2 image, use color math to add a R1G1B2 layer on top to get R4G4B4. But you run out of data to store pixel data: 65536 bytes is only enough to store 43k pixels at 12bpp. Hence his comment about letterboxing it.


Top
 Profile  
 
 Post subject: Re: Max colour output
PostPosted: Sat Sep 22, 2018 5:31 pm 
Offline
User avatar

Joined: Fri May 08, 2015 7:17 pm
Posts: 2308
Location: DIGDUG
Thought. If someone makes a retro console in the future.

5 bits per color is really more than the human eye can differentiate. They should have gone 4 bits per color, and used the extra 4 bits for alpha (transparency). Then they could have eliminated all that color math difficulty.

_________________
nesdoug.com -- blog/tutorial on programming for the NES


Top
 Profile  
 
 Post subject: Re: Max colour output
PostPosted: Sat Sep 22, 2018 5:52 pm 
Offline

Joined: Wed May 19, 2010 6:12 pm
Posts: 2760
I could still can tell shades between colors in 15-bit colors most of of the time.


Top
 Profile  
 
 Post subject: Re: Max colour output
PostPosted: Sat Sep 22, 2018 7:09 pm 
Offline

Joined: Sun Apr 13, 2008 11:12 am
Posts: 7676
Location: Seattle
In the Not-Quite-So-Bad-Old-Days, image viewing software often had an option to dither its output for 15- or 16- bit displays. Color banding is really obvious otherwise.


Top
 Profile  
 
 Post subject: Re: Max colour output
PostPosted: Sat Sep 22, 2018 8:02 pm 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 20679
Location: NE Indiana, USA (NTSC)
As an experiment, I scaled "Nethil and Sarah's bunny", a photo of two plushies, to 256x224 pixels and bit-crushed it using twelve settings: six depths (R5G5B5, R4G4B4, R3G3B3, R3G3B2, 8bpp with optimized palette, and 4bpp with optimized palette) and two dithering types (off or Bayer). I can see the banding on R5G5B5, particularly on the white area in the background.

In my subjective opinion, the 8bpp with optimized palette version looks as good as R4G4B4. The 4bpp version doesn't look quite as good as the R3G3B2 version, but better is possible by choosing different 15-color palettes for different parts of the picture. (My software doesn't do that.)


If you're curious about the lore behind this photo, let me know and I'll explain the back story of Nethil (the one in the yellow shirt).


Attachments:
allbig.png
allbig.png [ 1.16 MiB | Viewed 1114 times ]
Top
 Profile  
 
 Post subject: Re: Max colour output
PostPosted: Sat Sep 22, 2018 8:28 pm 
Offline

Joined: Fri Jul 04, 2014 9:31 pm
Posts: 966
dougeff wrote:
Then they could have eliminated all that color math difficulty.

The N64 tried replacing "color math" with alpha, and look where it got them. They had to shove in additive blending at the last second, and it ended up basically useless anyway because they hadn't bothered to clamp the output of the blender, on the grounds that alpha blending with clamped sources can't overflow. This is why glow effects sucked on the N64.

Also, with alpha blending you still have to worry about what you're blending it with. The SNES could do exactly one blend operation per pixel. By "retro console" I assume you mean something with a linear constant-time renderer like the S-PPU, as opposed to a framebuffer blitter like the RCP; in that context it seems to me you'd have to devote a fair amount of silicon to pixel blending if you wanted to avoid the main screen/subscreen limitation and blend anything with anything else.

I wonder if it would have been feasible to allow individual sprites to be sent to either the main screen or the subscreen (basically having two linebuffers). It's a pretty harsh limitation to never be able to blend sprites with each other at all, ever... It would probably have cost more silicon than they wanted to spend on a feature that was already way beyond anything their competition could do...

psycopathicteen wrote:
I could still can tell shades between colors in 15-bit colors most of of the time.

Even with 24-bit colour you can see banding under certain circumstances. The human eye is way better at telling the difference between shades when they're right next to one another.


Top
 Profile  
 
 Post subject: Re: Max colour output
PostPosted: Sun Sep 23, 2018 4:07 am 
Offline

Joined: Sat Apr 07, 2018 7:39 pm
Posts: 12
Tepples:

That image may be quite good under just 256 colours: I think it looks better even, as you're in a 5-5-5 colour space compared to the 4-4-4.
However if you really wanted to show off the 4-4-4 colour space you'd have to use a really high colour image which ends up using more than 256 colours from that space. Currently the bunny one probably uses less than the one from the pallette mode.

That's why this scene from Overdrive looks so weird, there's a huge colour range in it.


Attachments:
512C.png
512C.png [ 747.54 KiB | Viewed 1066 times ]
Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 47 posts ]  Go to page 1, 2, 3, 4  Next

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 6 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group