Sign in to follow this  
godsenddeath

What is a color plane?

Recommended Posts

I've come across the term when loading graphics files, and I'm writing a PCX loader and it's come up again. I can't find a good explanation of what it refers to, and how it applies to the data. Does anyone have a quick explanation? Thanks.

Share this post


Link to post
Share on other sites
A color plane seems to just be a "quad" where the coordinates on that quad (from 0 to 1) correspond how much of a color to use (primary color it seems to be).

So for instance if you did a color plane for Red and Green...

the lower left corner (0,0) would be black
the lower right corner (1,0) would be pure red
the upper left corner (0,1) would be pure green
the upper right corner (1,1) would be bright yellow (full mix of red and green).

this link might help too

http://www.programmersheaven.com/mb/graphics/361100/361100/color-planes/

anyhow, you shouldn't need anything like this for a pcx loader, its strange you came across it but maybe you can just ignore it.

PCX's have color pallets stored inside of them I'm pretty sure so all you should care about is converting indexes into the palette into full RGB color.

But anyhow, why are you making a pcx loader? Is it just to learn / have fun?

If not, you should look at using PNG's.

You can get the source code easily online for loading PNG's, they compress way better than PCX (while still using lossless compression), they have full 24 bit color, and a full 8 bit alpha channel.

It is a really good format, png FTW

Share this post


Link to post
Share on other sites
Looks like in the case of PCX, it just means one of the three color channels. But writing a PCX loader is a colossal waste of time.

Share this post


Link to post
Share on other sites
Quote:
Original post by Promit
Looks like in the case of PCX, it just means one of the three color channels. But writing a PCX loader is a colossal waste of time.



Thats what I gathered, but I'm guessing it's not the same idea as in other formats?


I'm aware the format is long dead, but I'm writing a MD2 loader (well, wrote one), and I can't seem to find a PCX loader for DirectX, so I figured I'd write one.

Share this post


Link to post
Share on other sites
Color plane is a mostly irrelevant concept today, but it originates from the way hardware was designed.

For reasons which I no longer remember, rather than using RGB tuple to represent colors in memory, each of colors was stored in separate region of space. So reds would be first X bytes, then greens, then blues. Similar to what split channels does in Photoshop or similar. Seems that wiki has an illustration. Could have something to do with signal generation that made logic simpler if parsing separate channels.

Mode-X used similar trick to interleave rows to allow faster image buffer swap by encoding plane information in two bits of each pixel, but reduced color information to 6 bits. Or something similar...

Then there were VESA banks and associated interrupts mapping the A000 offset to video memory, .... All of that should be completely irrelevant today for anyone who is not writing drivers.

But yea, up the hill, in the snow, ....

Share this post


Link to post
Share on other sites
Yep, a color plane is simply a bit-map containing a single color component. So you'd have 3 planes of red, green, blue, rather than having one 1 array of RGB triplets, for example.

One of the reasons this scheme was/is used, as opposed to the more well-known RGB triplets and quads, is that by separating the primary colors from one another, you can often gain better compression ratio using typical compression schemes -- Imagine you have an image that's composed of green-scale 'static' (like a television, so there is no aparent pattern). Many compression schemes have a hard time dealing with this if each pixel is made up of an RGB triplet, however a color-plane-based compression scheme can trivially throw out the entire red and blue color planes, reducing the image data by 2/3rds, before it even begins to look at the "real" data.

In the olden-days, some video hardware actually worked like this (on the amiga for example) and in some cases went down to individual bits (so a screen might have been made up of 15 individual bit-planes, for example).

Share this post


Link to post
Share on other sites
Quote:
Original post by Promit
My suggestion would be:
1) Install Paint .NET.
2) Install PCX plugin.
3) Resave the texture in a format that doesn't suck.


Good advice for OP, and i just wanted to add "Gimp" to the list which is basically the open sourced answer to photoshop and lets you load and save lots of different formats.

GIMP

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this