VICE Palette File (vpl) editor.

You need an actual VIC.

Moderator: Moderators

User avatar
buzbard
Vic 20 Devotee
Posts: 213
Joined: Sun Jul 03, 2005 9:10 am

VICE Palette File (vpl) editor.

Post by buzbard »

Here's a program that I put together to edit VICE Palette Files (vpl).
Image
PaletteEditor .11.zip

This is a Windows program, (sorry to everyone else).
It requires the Visual Basic 6 runtime dll.

Press 'F1' for a list of keys used.

You'll notice a small box in the lower-right corner of the program that changes color. That color is whatever color that happens to be under your mouse. Press SPACE or ENTER to copy that color into the selected color number. Makes it really easy to capture colors from screenshots. :D

I've tried to weed out all the bugs, I think I got 'em all, but if you find one let me know here.

Enjoy! 8)

Visual Basic 6 source code: PaletteEditor .11-Source.zip
Last edited by buzbard on Sun Aug 31, 2014 11:33 am, edited 2 times in total.
Ray..
User avatar
orion70
VICtalian
Posts: 4341
Joined: Thu Feb 02, 2006 4:45 am
Location: Piacenza, Italy
Occupation: Biologist

Re: VICE Palette File (vpl) editor.

Post by orion70 »

Very interesting and useful! Hope some perfectionist here will come up with a "perfect" palette for the VIC :P
User avatar
buzbard
Vic 20 Devotee
Posts: 213
Joined: Sun Jul 03, 2005 9:10 am

Re: VICE Palette File (vpl) editor.

Post by buzbard »

Thanks. That was my idea, to make editing as simple as possible. :D

I added a link to the source code in the first post.
Ray..
User avatar
tokra
Vic 20 Scientist
Posts: 1123
Joined: Tue Apr 27, 2010 5:32 pm
Location: Scheessel, Germany

Re: VICE Palette File (vpl) editor.

Post by tokra »

orion70 wrote:Very interesting and useful! Hope some perfectionist here will come up with a "perfect" palette for the VIC :P
I'd suggest using the mike.vpl from this thread:
Help improving the VIC20 palette in vice!
I really like this palette a lot better than the default.vpl

Mike also has an NTSC AVI from my NTSC-S-Video-VIC-20 and should/may be able to produce a mike-ntsc.vpl from that one... ideally these would be the standard palettes for VICE - maybe I'll open a "feature request" in the VICE-sourceforge.
groepaz
Vic 20 Scientist
Posts: 1187
Joined: Wed Aug 25, 2010 5:30 pm

Re: VICE Palette File (vpl) editor.

Post by groepaz »

tokra wrote:Mike also has an NTSC AVI from my NTSC-S-Video-VIC-20 and should/may be able to produce a mike-ntsc.vpl from that one... ideally these would be the standard palettes for VICE - maybe I'll open a "feature request" in the VICE-sourceforge.
it'd be more useful to find out how exactly the colors are generated and fix the internal color generator (IF what VICE does is actually wrong) - using RGB palettes for this is always going to be wrong in one way or another.
I'm just a Software Guy who has no Idea how the Hardware works. Don't listen to me.
User avatar
tokra
Vic 20 Scientist
Posts: 1123
Joined: Tue Apr 27, 2010 5:32 pm
Location: Scheessel, Germany

Re: VICE Palette File (vpl) editor.

Post by tokra »

I agree. Reading some old threads I think NTSC and PAL would probably need different palette-files:

Help needed from NTSC-VIC-users

Apart from Jeff's VIC all other NTSC-VICs tested produce peculiar results with Light Orange/Light Red/Light Purple.

I could not find information on how the original default-palette for the VIC-20 in VICE came about, but it seems to be unchanged since 1998.
groepaz
Vic 20 Scientist
Posts: 1187
Joined: Wed Aug 25, 2010 5:30 pm

Re: VICE Palette File (vpl) editor.

Post by groepaz »

tokra wrote:I agree. Reading some old threads I think NTSC and PAL would probably need different palette-files
as said, "palettes files" are not going to work right, ever. and i doubt somehow that the pal and ntsc VICs actually have different color generation (why would they really)
Apart from Jeff's VIC all other NTSC-VICs tested produce peculiar results with Light Orange/Light Red/Light Purple.
where they tested against each other using the same display? if not, comparing them isnt very useful either. CRTs, and especially NTSC ones, wildly vary when it comes to color reproduction. dont trust them at all :) when i asked a bunch of people for screenshots of their C64s, i got several wildly different ones, didnt help in any way to fix anything =P
I could not find information on how the original default-palette for the VIC-20 in VICE came about, but it seems to be unchanged since 1998.
probably the same way the original c64 palettes were made - by eye comparison, like in this thread :)

that said, i'm happy to include better palettes in VICE... and the testprogram used in that other thread would also be a nice addition to the testprograms repository.
I'm just a Software Guy who has no Idea how the Hardware works. Don't listen to me.
User avatar
Mike
Herr VC
Posts: 4838
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Re: VICE Palette File (vpl) editor.

Post by Mike »

Groepaz,

first of all: the *only* two things that could be measured in an objective way are the luma and chroma signals as they appear on the pins of the VIC. Whatever happens until they get displayed as colour is entirely at the discretion of the whole signal circuitry between those pins and the RGB phosphors on the CRT.

The chroma signal of the VIC-I is quite misbehaving. It more resembles a square wave, rather than a sine. It is then mixed into the luma signal to produce the composite video signal. Parts of the chroma signal are later mistaken for luma information, which leads to pixel tearing especially with red, green, purple, cyan and orange colour, and their light variants. This pixel tearing in not modelled in any way by VICE! On PAL, these checkerboards are steady, on NTSC they flip over each frame, thus the effect is less apparent there.

Many people have done a S-Video mod on their VIC-20, which makes this pixel tearing disappear, that mod should be selectable in VICE.

With PAL, the chroma information also leaks to the next pixel and to the following line. This cannot be modelled in any sensible way using just a RGB palette - in that point I wholeheartly agree with you. For example, if you put a solid red block over a solid cyan block, the first line of the cyan block appears in orange! Likewise, with a cyan block over a purple block, the mixing colour in the first line of the purple block is blue. Again, this isn't modelled in any way by VICE.

Even and odd rasters show slightly different colours. This is quite visible with yellow and cyan.

White does not use the full intensity, and there are some colours which exceed the intensity of white in one of the R, G or B channels, after they have been transformed from YUV to RGB. Gamut?

Finally gamma. Different output devices have a different interpretation of the same (linear) intensity for each channel. Especially for secondary colours, this can make the difference between an orange tinted or greenish tinted brown (depending how strong the mid-intensity green is mixed in).

A faithful emulation of the video output would thus need to incorporate:

- accurate generation of luma and chroma signals by VIC,
- the mixing circuitry which generates the composite signal,
- the amplifiers, delay line and matrix chip within the monitor,
- the deflection coils and their effect on the electron beams,
- the intensity of the 3 electron beams as modulated by the matrix chip,
- the reaction of the RGB phosphors, and how they fade over time.

Actually, one then would have to take into account, that output howadays happens on TFTs, with different realisations of the primary colours, a frame rate converter is necessary to resample the output. Etc.

All that effort in the end would it only get right for one combination of VIC-20 and CRT. Hopefully there's a technical compromise which would include improvements of the VIC-I colour generation as I pointed out above. And adding support for NTSC interlace would also be nice. :mrgreen:
groepaz
Vic 20 Scientist
Posts: 1187
Joined: Wed Aug 25, 2010 5:30 pm

Re: VICE Palette File (vpl) editor.

Post by groepaz »

the VICE CRT emu emulates s-video, not composite - correct. the PAL typical chroma mixing with next line IS modelled though ;) (and blur to next pixel also). the odd/even line differences have been in for a while now as well... and gamma of course =P

yeah i know what needs to be emulated, spent a fair amount of time on this topic... i think to improve it further we need to go the open-gl shader way though, doing what we have in software is slow enough already (CRT emu already takes by far the most CPU time) - but that will not happen for a while unless someone else steps up and works on it.

and yeah well, interlace is a completely different topic, it cant be done in the current rendering system of VICE (similar problems exist with the VDC of the c128)
I'm just a Software Guy who has no Idea how the Hardware works. Don't listen to me.
User avatar
Mike
Herr VC
Posts: 4838
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Re: VICE Palette File (vpl) editor.

Post by Mike »

groepaz wrote:the PAL typical chroma mixing with next line IS modelled though ;) (and blur to next pixel also). the odd/even line differences have been in for a while now as well...
I checked against the build of xvic I'm currently using (WinVICE x86 2.4.2 r27141) and looked a bit sharper with the two colour transitions I gave as example. And indeed I stand corrected (also regarding the odd/even line colours).

It is just not that apparent in VICE as it was in a photo I once made from a 1084 with these colour blocks on display. Must have been a case of a slightly stronger colour saturation setting. :)

Cheers,

Michael
groepaz
Vic 20 Scientist
Posts: 1187
Joined: Wed Aug 25, 2010 5:30 pm

Re: VICE Palette File (vpl) editor.

Post by groepaz »

yes, the defaults are set up so the effect is only barely visible (it should look like a very good monitor, not some 80s tv =))
I'm just a Software Guy who has no Idea how the Hardware works. Don't listen to me.
User avatar
buzbard
Vic 20 Devotee
Posts: 213
Joined: Sun Jul 03, 2005 9:10 am

Re: VICE Palette File (vpl) editor.

Post by buzbard »

tokra wrote:
orion70 wrote:Very interesting and useful! Hope some perfectionist here will come up with a "perfect" palette for the VIC :P
I'd suggest using the mike.vpl from this thread:
Help improving the VIC20 palette in vice!
I really like this palette a lot better than the default.vpl

Mike also has an NTSC AVI from my NTSC-S-Video-VIC-20 and should/may be able to produce a mike-ntsc.vpl from that one... ideally these would be the standard palettes for VICE - maybe I'll open a "feature request" in the VICE-sourceforge.
I download Mikes palette and loaded it up in my editor and my first thought was "someone (besides Jeff) is definitely color blind!", but after a few seconds I realized my mistake.
I'd been developing this program using a C64 palette, and I had forgotten that the VIC20s palette was different.

So I have to say thank you to tokra and Mike for pointing me in the right direction.

Therefore there is a new version, the links in first post have been updated.

I added a "preview" window (of sorts), PET palettes(2 colors WooHoo!), separated VIC & VICII palettes and a rudimentary way to distinguish between VIC & VICII palettes.

The VICII palette has "Dark Gray" as color number 11 and the VIC has "Light Cyan".
The red, green & blue values for dark gray are nearly the same, but light cyan has a decent difference between the red and blue values, so that's where I do the testing (when loading a palette), and if the values between red and blue are greater than 50 then it must be a VIC palette. :shock:
If anyone can think of a better way... :?

Next I'll probably add the C128s VDC palettes.

Thanks to everyone else for the encouraging comments.
Ray..
groepaz
Vic 20 Scientist
Posts: 1187
Joined: Wed Aug 25, 2010 5:30 pm

Re: VICE Palette File (vpl) editor.

Post by groepaz »

btw, if you really insist on making RGB palettes like that.... it'd make a lot of sense to arrange the colors in luminance order instead of their palette order (which is very arbitrary). also a feature that would display the resulting palette in b/w (ie just luma) would make it easi(er) to select colors that are somewhat close to reality :)
I'm just a Software Guy who has no Idea how the Hardware works. Don't listen to me.
johncl
Vic 20 Amateur
Posts: 58
Joined: Sat Dec 22, 2007 3:17 am

Re: VICE Palette File (vpl) editor.

Post by johncl »

Interesting thread. I was looking for some decent VPL files for Vice Vic20 emulation so that I could test both PAL and NTSC - anyone have any decent ones? (There was only one VPL file in the link above). I saw Mike that you created these (from wayofthepixel):

NTSC
Image

PAL
Image

If anyone got VPL files for these it would be nice to get hold of those.

Btw here is Vice 2.3 demonstrating the colour bleed that Mike mentioned:

Image

There is indeed a grey line and a purple-blueish line there. :) - Hmm maybe it can be used to some special effect. :)
johncl
Vic 20 Amateur
Posts: 58
Joined: Sat Dec 22, 2007 3:17 am

Re: VICE Palette File (vpl) editor.

Post by johncl »

Ok, that palette editor in this thread works nicely (thanks for making it easy to sample colours) - and the mike.vpl file linked above was the same as the palette I linked (which was also made by Mike - so no surprises there). I was unable to find a link to the NTSC one though, so I made one from Mikes NTSC palette image and here is a link to that in case anyone needs it.

Mike's NTSC Palette
Post Reply