If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.
![]() |
|
|
#1 |
|
Member
Join Date: Sep 2002
Posts: 381
|
There is a rarely used desktop mode that consists of a bitmap of indices ranging from 0-255 (one byte) into an array of 3/4 byte colour values. If you wish to change all the pixels on a display of one colour, you can using one write to the palette instead of a scan of all the pixels doing a comparison and a read and write for each. The main problem has been that 256 colours are not enough to go around when you have many display elements, Windows switches palettes to the palette of the active window and generally forces all windows to share a subset of colours.
What if each pixel were a two byte index into a palette 4 bytes wide? You could fetch twice as many pixels during a read, but you have to read the palette entries anyway, making the advantage moot, also you are accessing non sequential parts of ram, anothing inefficiency. The benefit would be on the side of changing large sections of the display using one write. Overall though, you can see the reason why such a mode isn't on the roster, it is just as much work and you have more control over individual pixels. Also, there is 16 bit mode, which many consider pretty good, but I find really has limited colour values which would be neatly solved if each pixel were an index into real colours. Ok, the thought I had came to me when considering larger colour palettes of 64 bits+, wouldn't the savings and features balance shift once again to palettes? From what I understand textures are rarely larger than 256x256 in use in today's games, and future games are using finer details, if you wanted textures with greatter than 32 bit precision, or one with a large alpha channel seems to me a palette would be handy, for 256x256 you'd have a palette entry per pixel. There is probably something like that already in existance, but I wouldn't know. Of course, it would probably never be an option, any new idea has to be able to fit into the current legacy of the PC, but this seems to be a forum for discussing random ideas, so I thought I'd ramble on. |
|
|
|
|
|
#2 |
|
Regular
Join Date: Feb 2002
Location: Kings Langley
Posts: 446
|
Palletes are typically handled in hardware, using a built in LUT (look up table).
Calls to set the pallete are translated by the driver into writes into the hardware LUT. Then when the indexed data is fetched from framebuffer the DAC depalletizes the data using the LUT. This has no impact on memory access as the LUT is on chip, so you really do read 1 byte per pixel. Expanding the lut to be indexed using two bytes gives you 64K unique entries. So you could represent images with greater color accuracy, but given how cheap memory is at the moment this seems like too much work. You also cannot do arithemetic operations on the data in the framebuffer if it is palettized, as the colors for a given entry are completly arbitrary. Standard 16 BPP can (and is) be used in blending and arithmetic operations. Textures are (I think) getting bigger and bigger. Windows is heading towards everything running through the 3d pipe, which requires arithmetic operations on the texture values. The only to handle this would be for the 3d hardware to depalletize the data do the operation, it would then have to either quantize the value to the existing palette, or modify the palette to allow for the new color value, as the result of the arithmetic operation is certainly not guaranteed to already exist in even your expanded pallette. Interesting idea though. CC. |
|
|
|
|
|
#3 | |
|
Member
Join Date: May 2002
Location: Santa Clara
Posts: 584
|
Quote:
You then produce versions of this table for each possible operation - ADD, SUB, MUL etc. |
|
|
|
|
|
|
#4 | |
|
Regular
Join Date: Feb 2002
Location: Kings Langley
Posts: 446
|
Quote:
This requires doing a lot of calculations anytime someone alters even one pallete entry, which kind of defeats the original suggestion of using palletes. This aslo assumes that the data you are using is always palettized, if one of the textures is not palettized then the table approach does not work. CC |
|
|
|
|
|
|
#5 | ||
|
Member
Join Date: May 2002
Location: Santa Clara
Posts: 584
|
Quote:
Attempting to display unpaletted data on a paletted screen would be somewhat strange behaviour, and very difficult to do quickly. Fundamentally the time for palettes _is_ probably past, except for some rather esoteric uses like vector map compression, and even for these the quality tradeoff is not good. |
||
|
|
|
|
|
#6 |
|
Member
Join Date: Mar 2002
Posts: 141
|
That's all anybody uses on the PS2.
|
|
|
|
|
|
#7 | |
|
Member
Join Date: May 2002
Location: Santa Clara
Posts: 584
|
Quote:
On the vast majority of typical texture images DXTC provides better results at 1/2 the size of 8 bit paletted textures, so palettes are largely obsolete for texture compression on all the other game consoles and PC hardware. |
|
|
|
|
|
|
#8 |
|
Member
Join Date: Feb 2002
Location: Seattle, WA
Posts: 124
|
Apple, Sun, and SGI all did some cool tricks with 8-bit and 4-bit paletted textures, back in the day. If you build lookup tables, and dither, you can actually do a lot of color space conversions and 3D math with paletted textures.
But these days, with cheap RAM, it doesn't make much sense. With next-generation hardware (9700, NV30) we're seeing pixels getting larger, not smaller. The future is going to be floating point pixels. |
|
|
|
|
|
#9 |
|
Member
Join Date: Jul 2002
Location: estonia
Posts: 301
|
"Palette" is nothing more than a compression method.
With 1,9M pixels being on screen in 1600x1200 mode, and 32bit color enabling for 4,300M different color values, obviously palette-based compression scheme would make some sense.. Its just that with traditional palette implementations multipass rendering would become prohibitively expensive. Blending ops would perhaps be possible with dynamic palette size, i.e. if op result colour is not found in palette then new entry is created. Compression works best if compression method matches the data patterns, i.e. some (lossless) compression algos work best with audio data, some with still image data etc. Obviously, compression schemes for Z-buffer, stencil buffer, RGB and alpha channels should not be same. Its just that selecting the best algo-s for every situation and implementing all coders/decoders in HW is pretty much impossible. Also, to my understanding, "reverse" palette ops (i.e. finding palette entry from LUT. given RGB values ) are not well-suited for hardware at all. I cant imagine how quicksort and binary search would be ever implemented in HW :P |
|
|
|
|
|
#10 |
|
Member
Join Date: Sep 2002
Posts: 381
|
Perhaps what I was looking for is more of a bitmap format standard and possibly driver/hardware support for BitBlts to a higher level screen buffer. Thinking more of visual styles and colour preferences, changing a palette to make the entire gui brown or blue would be less expensive than sending messages to all the windows and controls for them to change pixel contents.
|
|
|
|
|
|
#11 | |
|
Junior Member
Join Date: Aug 2002
Posts: 29
|
Quote:
OpenGL supports GL_EXT_palette_texture to use paletised textures. The biggest problem with palette textures is that if you use linear filtering, you multiply by two the number of memory transfers you need for a single texel fetch (32 fetches for quadlinear filtered 3D textures!) and you cannot initiate the LUT fetch until you have done the color index fetch, so the latency increases (unless you cache the palette onchip). EDIT: Added bumpmapping url |
|
|
|
|
|
|
#12 |
|
Member
Join Date: Mar 2002
Posts: 141
|
A palette is only 1kb, it is likely cached away in some fast memory when texturing is performed (on the PS2 it is). Sure you gotta do a few more lookups, but you save on texture cache misses because the texture data is smaller.
For most games you can't even tell the difference, as long as the textures aren't too big and you got a unique palette per texture it looks just as good as 32 bit. We're not talking 8bit palettes like back in the software rendering days where all you had was ONE SINGLE palette. Now you can have one per texture, and it's a great compression scheme. You can also do neat stuff like clut animations very cheaply. |
|
|
|
|
|
#13 |
|
Member
Join Date: Feb 2002
Location: Norway
Posts: 542
|
Fresh, can you recomend a good program to convert pictures to 8bit color? MsPaint did a horrible job on my test picture, it look like it used a default palette, instead of making one optimised for the picture. I also tried Gimp. Half the test picture was a block of solid color, but Gimp actually failed to put that color in the palette!! Instead it dithered with three other colors to generate the correct shade.
|
|
|
|
|
|
#14 |
|
Crazy coder
|
Paint shop pro generally does a good job.
|
|
|
|
|
|
#15 |
|
Member
Join Date: Jul 2002
Location: estonia
Posts: 301
|
|
|
|
|
|
|
#16 | ||
|
Member
Join Date: May 2002
Location: Santa Clara
Posts: 584
|
Quote:
Palettes are no longer a great compression format because for almost all types of images DXTC produces better results at half the storage size without additional dereferences. There are, of course, exceptions where palettes do produce better results (normal maps as mentioned above) Quote:
'As long as the textures aren't too big?' I want bigger textures - that seems to be one of the major points of using compression in the first place (although perhaps not on architectures with really low memory limits...). With DXTC generally the bigger the textures get the better the visual quality of the compression becomes (when you think about how the compression is performed the locality of the colourspace is likely to improve when each block covers a smaller percentage area of the texture). With palettes the larger the textures become the more compromise has to be made in mapping the limited number of available colours over the whole image. Palettes are very good at compressing small textures, but if they're already small then the advantages become more nebulous. Palettes are not a 'great' compression scheme - there are manifestly better ones to be had for general texture compression in hardware. They do, however, have some nice secondary properties (such as the clut animation you touch on above) |
||
|
|
|
|
|
#17 | ||
|
Member
Join Date: Feb 2002
Location: Norway
Posts: 542
|
Quote:
Quote:
But I did find one program that finally managed to do it; the 'convert' command in Linux (I also know that Solaris has it, so I assume its standard with most UNIX like systems). Oh, and sorry if this post is a little OT. |
||
|
|
|
|
|
#18 |
|
Tea maker
Join Date: Feb 2002
Location: In the Island of Sodor, where the steam trains lie
Posts: 4,396
|
Since we are discussing the relative quality of S3TC/DXTC, the following comparison of texture compression methods pages I wrote a long while ago would be relevant. (One day I might add PVR-TC.)
The biggest problem with palettised (or more generally VQ) textures is the indirection needed to access the Palette/LUT (look up table). To get good quality you really want an individual LUT per texture and to overcome the latency it needs to be "cached". Furthermore it has to be multi-ported (i.e. expensive) to support texture filtering . The simplest thing to do is to load the entire LUT when you first encounter the texture, but that is very expensive if you only process a few texels out of that texture. For these reasons there's been a shift toward more block oriented texture compression methods, even though they generally achieve less compression.
__________________
"Your work is both good and original. Unfortunately the part that is good is not original and the part that is original is not good." -(attributed to) Samuel Johnson "I invented the term Object-Oriented, and I can tell you I did not have C++ in mind." Alan Kay |
|
|
|
|
|
#19 | ||
|
Tea maker
Join Date: Feb 2002
Location: In the Island of Sodor, where the steam trains lie
Posts: 4,396
|
Quote:
[Update]By the sound of your example, it seems that the quantizer might first be reducing the colour precision of the original image, possibly to make the searching faster[/Update]
__________________
"Your work is both good and original. Unfortunately the part that is good is not original and the part that is original is not good." -(attributed to) Samuel Johnson "I invented the term Object-Oriented, and I can tell you I did not have C++ in mind." Alan Kay |
||
|
|
|
|
|
#20 |
|
Member
Join Date: Jul 2002
Location: estonia
Posts: 301
|
Obviously palettes or VQ compression would have its uses in modern cards as well, just the implementation needs to be more flexible than old-skool 256-color palettes.
as a side, stencil buffers and framebuffer alpha channels would generally yield to pretty high compression rate, i wonder if anybody is doing something in that area ? Or does Z-buffer compression already take care of stencil as well ? |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Help please: Obsolete 2GHz P4 wanted... | Guden Oden | Hardware & Software Talk | 5 | 13-Sep-2004 12:39 |
| "DVDs will be obsolete in 10 years: Bill Gates" | Wunderchu | Hardware & Software Talk | 24 | 22-Jul-2004 09:00 |
| 4-bit textures are OBSOLETE? | Console Technology | 3 | 28-Jan-2003 22:56 | |