It is currently Wed Sep 19, 2018 9:52 pm

All times are UTC - 7 hours



Forum rules





Post new topic Reply to topic  [ 103 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6, 7  Next
Author Message
PostPosted: Tue Apr 10, 2018 8:06 pm 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 20562
Location: NE Indiana, USA (NTSC)
Do you want exact or good enough? For good enough, you could take the RGB values out of an image built with an NES palette generation tool and convert them from 8bpc to 5bpc.


Top
 Profile  
 
PostPosted: Tue Apr 10, 2018 8:28 pm 
Offline
User avatar

Joined: Sun Sep 19, 2004 9:28 pm
Posts: 3594
Location: Mountain View, CA
Find any emulator that uses .pal files (example: FCEUX; see Palettes\ directory). Here is the file format. Pick one that you think best represents the NES. Nice and easy.


Top
 Profile  
 
PostPosted: Wed Apr 11, 2018 1:41 am 
Offline

Joined: Fri Mar 01, 2013 4:46 am
Posts: 301
I'd like to do exact nes colors on the snes. Also the palette viewer in bsnes displays incorrect colors when creating the colors. If I try designing a color by watching the main game screen, I'll get an incorrect color block in the viewer. If I try creating a color within the palette viewer, then the main screen shows an incorrect color. I tried eyeballing it but that is taking a long time for me to do.

I will try what you two just suggested. Thanks for the help/guidance!


Top
 Profile  
 
PostPosted: Wed Apr 11, 2018 6:06 am 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 20562
Location: NE Indiana, USA (NTSC)
If you really want "exact" color matching to where a user can't ABX the difference between pixels from the NES and Super NES on the same monitor even if he tries, you'll need to dive into the pit that is NTSC: Never The Same Color.

You claim that colors look right on a flat screen but look wrong in detailed pixel art but vice versa. One problem you might be running into is that colors of adjacent pixels mix in occasionally nonintuitive ways. This is in part due to the limited bandwidth of the NTSC chroma subcarrier and the shortcuts taken by the NES and Super NES to generate an NTSC-compatible signal with little silicon. They might even be mixing slightly differently on NES and Super NES or even between resets on the same console. And because you mentioned emulators, you might also be seeing the effect of your TV and computer monitor being set to different brightness, contrast, or color (saturation, tint) settings.

For "exact", you'll probably need a setup involving an oscilloscope to determine which Super NES RGB triplet's output waveform after NTSC encoding has a center level, phase, and amplitude (after low pass filtering) closest to each of the distinct NES colors. And you'll want to look at these waveforms after low pass filtering in order to take into account the difference between the NES's square wave chroma waveform and the Super NES S-ENC/S-RGB's presumably sinusoid chroma waveform.


EDIT: Expanded the lead sentence to clarify how I had interpreted the word "exact" in infidelity's prior post


Top
 Profile  
 
PostPosted: Wed Apr 11, 2018 2:50 pm 
Offline

Joined: Wed May 19, 2010 6:12 pm
Posts: 2749
I remember hearing talk about how the NES's square color carrier has some kind of slew rate distortion where $1x and $2x colors get hue shifted because the saturation is higher than $0x and $3x colors. Is that caused by the NES's circuitry, or because of the TV's circuitry, and if the former, how much specific math do we know about it?


Top
 Profile  
 
PostPosted: Wed Apr 11, 2018 3:12 pm 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 20562
Location: NE Indiana, USA (NTSC)
Results from NewRisingSun show that $3x gets shifted even more than $2x. The highest brightnesses are shifted "up" the rainbow, so to speak. Thus it appears not to be slew rate (delay based on difference from old level) as much as output impedance (delay based on amount of current flowing through the chip).


Top
 Profile  
 
PostPosted: Wed Apr 11, 2018 3:27 pm 
Offline
User avatar

Joined: Thu Apr 23, 2009 11:21 pm
Posts: 924
Location: cypress, texas
Note: my reply is off topic.

tepples, you have been blessed with an extremely brilliant mind. You understand deeply about: NES color, SNES color, and NES music; how to tackle the conveluded, to me at least, task that infidelity must follow to accomplish exact NES colors on a SNES; valid_left and visible_left scrolling wisdom. Sometimes your posts impress me so much; my brain is just overloaded; keep up the good work. :)


Top
 Profile  
 
PostPosted: Wed Apr 11, 2018 4:24 pm 
Offline
User avatar

Joined: Sun Sep 19, 2004 9:28 pm
Posts: 3594
Location: Mountain View, CA
@infidelity -- ignore all of the above hemming and hawing over NTSC subcarriers, adjacent pixels, saturation/tint, chroma waveforms, colour carriers, etc.. Don't think about that stuff right now -- it's extremely complicated and you will spend way too much time trying to comprehend it vs. staying the course. It's just another example of how quickly a thread can de-rail, despite everyone's positive intentions. (The info is relevant and valid, but it's complete overkill to try and learn right now)

You can certainly get similar or identical colours to the NES on the SNES, though there may be some slight variances given RGB vs. NTSC. The RGB values you're looking for are in those .pal files. Stay focused! :-)

This thread is one of the most enjoyable I've read in years. It's almost like seeing myself back in the early 90s when I was writing my SNES docs. I've told this story before somewhere, but I still remember the very first time I got text up on the screen in mode 0, followed by multi-coloured text, followed by multiple panning backgrounds. Hours and hours and hours of assembling + copying file to floppy + shoving it into an MGH + waiting + rinse lather repeat. That feeling of accomplishment you have? I remember it vividly -- it's worth it. Never forget that feeling.

Keep it up!


Top
 Profile  
 
PostPosted: Fri Apr 13, 2018 5:03 am 
Offline

Joined: Fri Mar 01, 2013 4:46 am
Posts: 301
Thanks koitsu! I haven't had a chance to get back to my test rom, I work 55/60 hours a week, so my free time is extremely limited, but tonight I should he able to get back to toying around. :-) I've been thinking about getting back to it alot this week. It's very exciting stuff! And from all he palette responses, I'm hoping get to get "near" the nes colors. Because what I'm doing right now is seeing how the bg layers look when I insert the tiles, and I want them to match color-wise how they appear on the nes. So I've been altering the bits via hex, but I've wasted so much time, so I'll grab the .pal you referenced and see if that helps in me setting the correct sets of bits.

I want to get that down before I venture to the other awesome functions of the system. :-)


Top
 Profile  
 
PostPosted: Fri Apr 13, 2018 3:22 pm 
Offline
User avatar

Joined: Sun Sep 19, 2004 9:28 pm
Posts: 3594
Location: Mountain View, CA
I'll try to explain the .pal file stuff and why it's a bit tricky (read: why you can't just take a raw .pal file and use it for CGRAM data on the SNES), but I'll provide a useful resource.

NES emulator .pal files are intended for emulators running on PCs/systems offering at minimum 24-bits colour. Most today are 32-bit.

The .pal file is formatted like this:

Byte 0 = Palette entry/colour #0 red
Byte 1 = Palette entry/colour #0 blue
Byte 2 = Palette entry/colour #0 green
Byte 3 = Palette entry/colour #1 red
Byte 4 = Palette entry/colour #1 blue
Byte 5 = Palette entry/colour #1 green
...going all the way up to palette entry/colour #63.

A byte per colour (red, green, blue) means that each colour is 8 bits in depth (range: 0 to 255). 8*3 = 24-bit total colour range.

SNES CGRAM, as you've learned, only offers 5-bit colour per red, green, and blue (re: %0BBBBBGGGGGRRRRR). 5*3 = 15-bit total colour range.

I want to be clear about something, because I know some reader (and possibly you) will misunderstand: the NES is not a "24-bit colour depth" system! I don't even want to talk about the "bit depth" of the colours on the NES: it's complicated because of how NTSC works and all that jazz (the stuff I said don't focus on, haha :P). The .pal files are intended for emulators as I said. This is also why in some emulators, instead of using a .pal file, they actually offer real-time NES colour calculation through formulas (some sliders/stuff can adjust it) (FCEUX for example has such: Config -> Palette -> NTSC Color Emulation). It's complicated. That's also why there's a bunch of different .pal files -- everyone thinks the NES's palette/colours look different. NTSC is responsible for a large amount of this, along with huge variances in TVs, plus everyone's TV's "hue" and "tint" knobs were set differently, etc... Everyone sees (and remembers) something a bit different.

So you might be wondering: how can you convert 24-bit RGB colour ranges (like in a .pal file) to the SNES's 15-bit colour range? You can, but there's going to be some loss of "quality", obviously. The Super Famicom Development Wiki actually talks about this exact thing, and how to do it. It gives very clear/excellent examples and formulas, with real values: https://wiki.superfamicom.org/palettes

Don't worry about converting 15-bit colour to 24-bit colour -- what you're interested in is the other way around.

Wrapping your brain around this shouldn't be too bad.


Top
 Profile  
 
PostPosted: Fri Apr 13, 2018 5:31 pm 
Offline

Joined: Fri Mar 01, 2013 4:46 am
Posts: 301
Thank you again koitsu, I have a .pal file, but I cant seem to view the colors R,G,B values within any emulator? It just (which I already know) shows the 8-bit value used for it, from #$00-#$3F.

I don't know what i'm supposed to use exactly to view the file properly?


EDIT, oooh I think I got it figured out, i'm using a hex editor to view the .pal file. And, the values that have A-F in them, I think I figured out how to decipher that to decimal form, and perform the formula, I'm through the first 5 colors of the nes palette, and the colors are matching on the snes palette viewer! I'll report back!


Top
 Profile  
 
PostPosted: Fri Apr 13, 2018 6:13 pm 
Offline
User avatar

Joined: Sun Sep 19, 2004 9:28 pm
Posts: 3594
Location: Mountain View, CA
Yes, the .pal files are binary (as I described). You use a hex editor or a tool that can dump a binary file into text in a format you might want.

For things like this, I honestly prefer just a tool that can dump it into some raw ASCII like $a1 $b2 $e0 $74 $22 or whatever. Some assembler suites even come with tools that do this for you. Seeing the data in ASCII as hex values can make your job of comprehending the data easier. An old DOS tool I used for this was called bin2db.exe which literally dumped a raw binary file into ASCII .db $xx statements.

The more you get into game development (esp. on the SNES), the more you are going to find that there is an extensive lack of tools to work with/manipulate data (esp. palettes/colours, images/CHR data, map data, ROM transfer, etc.). There were some back in the early 90s for MS-DOS, but these don't work on present-day systems. I still keep them around though. Most people now just write their own in some other language of their choice. I've complained about this before -- and please don't let this derail the subject of the thread -- but lack of tools is still a tremendous problem.

Some old DOS tools I have from the SNES days:

Code:
1996-11-16  13:04             5,952 BIN2DB.EXE
1997-04-16  18:00             3,157 CHR2PCX.DOC
1997-04-16  18:00            88,806 CHR2PCX.EXE
1996-11-16  08:16            18,960 GFXCONV.EXE
1993-07-12  17:30            37,845 GIF2SNES.EXE
1993-11-24  13:05            47,630 GIF2SOPT.EXE
1997-12-24  09:20            40,960 GRAPHICS.RAW
1993-08-05  09:30             9,025 IPS.EXE
1995-07-16  18:03            10,581 PATCHMK.EXE
1997-04-16  18:00             3,523 PCX2CHR.DOC
1997-12-30  15:57           150,016 PCX2CHR.EXE
1998-03-07  16:22             7,328 readchar.exe
1984-12-13  17:51            14,054 SGIF.EXE
1995-04-11  14:47             8,913 SGR.EXE
1996-01-01  11:39            11,185 SNESTL12.DOC
1999-01-11  16:27            23,978 SNESTL12.EXE
1980-01-14  10:22            15,775 TLAYER.EXE
1980-01-14  06:28                48 TLAYER.PAL
1980-01-15  06:55             7,439 TLAYER.TXT
1997-04-24  11:13            11,288 TRACER.DOC
1997-04-24  11:08            12,432 TRACER.EXE
1996-01-02  08:34            38,447 TSF.EXE
1996-01-02  08:34            19,968 TSF2.EXE
1994-07-18  18:40            55,834 UCON.EXE
1995-11-08  15:15            18,337 UCON14.DOC
1999-01-11  16:23            93,126 VGS.EXE
1997-04-10  17:10            40,766 x816.doc
1997-04-09  10:40            84,672 X816.EXE


Top
 Profile  
 
PostPosted: Sat Apr 14, 2018 4:49 am 
Offline

Joined: Tue Feb 07, 2017 2:03 am
Posts: 579
Yeah I still have the DOS tools form yore. I'm thinking that I might just have to set up my P133/Win95 box that I did my SNES work on back in the day in a permanent fashion if I'm going to do solid SNES work. And Find a copy of VS C++ 6.0 and back port my new tools to it...

I wonder if VirtualBox works with a USB disk drive and can support win95 VM... hmmm
EDIT : It does, bit of a pain to get it "just so" but seems to work fine ;)


Top
 Profile  
 
PostPosted: Sat Apr 14, 2018 11:14 am 
Offline

Joined: Fri Mar 01, 2013 4:46 am
Posts: 301
Got the .pal values converted. A little darker than what i'm used to, but I still like it! :-)

https://imgur.com/a/3gIQ5

Now to further expand my learning of the system. :-)


Top
 Profile  
 
PostPosted: Sat Apr 14, 2018 12:54 pm 
Offline
User avatar

Joined: Sun Sep 19, 2004 9:28 pm
Posts: 3594
Location: Mountain View, CA
Looks awesome! And yeah, they'll look slightly different due to the whole SNES RGB vs. NES HSV (hue/saturation/value/luma) aspect.

Nice chart, BTW. For readers: the SNES colour hex values shown are in low-byte-high-byte ordering, i.e. the order they'd be written to via $2122. I only mention this because when I first glanced them, I was like "$f75e?! That has the MSB set! No no no... oh, wait, he wrote them in L/H order..." :-)


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 103 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6, 7  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