Colormixing and distinct team units

Discuss your new mods and themes here

Moderator: Defcon moderators

User avatar
trickser
level5
level5
Posts: 1826
Joined: Thu Mar 06, 2008 2:15 pm
Location: The Senate ; GMT+1
Contact:

Colormixing and distinct team units

Postby trickser » Wed Nov 05, 2008 1:32 pm

I figured out how the colormixing works, its actually a multiplication.
You can create distinct units for the primary colors pretty easy. To make it work for all colors you would need some artist skills.

Image

The 3 small vessels are an ingame screenshot.

If someone wants some deeper info, just say so. I dont wanna post RGB values for no audience. :|
User avatar
rus|Mike
level5
level5
Posts: 2750
Joined: Thu Jun 28, 2007 5:52 pm
Location: Russia, St. Petersburg

Postby rus|Mike » Wed Nov 05, 2008 1:55 pm

Erm... how can that help?
User avatar
trickser
level5
level5
Posts: 1826
Joined: Thu Mar 06, 2008 2:15 pm
Location: The Senate ; GMT+1
Contact:

Postby trickser » Wed Nov 05, 2008 2:05 pm

?
help?
help what?
world peace? climate change? financial crisis?

I often read here someone wants to make a USSR vs USA mod, or Starwars Rebels against Imperium or something like that. Then someone comes and says sorry, its not possible to have distinct units for every player color. But it is and i want to show that.
User avatar
xander
level5
level5
Posts: 16869
Joined: Thu Oct 21, 2004 11:41 pm
Location: Highland, CA, USA
Contact:

Postby xander » Wed Nov 05, 2008 3:56 pm

It is additive/subtractive, not multiplicative, and this is old news. There are several topics that discuss this. And you will note that the method is imperfect, as it still leaves cruft in the units in-game. That cruft is almost certainly why this method hasn't been more widely implemented. Finally, it looks really bad for teams that are a mix of primary colors (say cyan or yellow).

xander
User avatar
trickser
level5
level5
Posts: 1826
Joined: Thu Mar 06, 2008 2:15 pm
Location: The Senate ; GMT+1
Contact:

Postby trickser » Wed Nov 05, 2008 5:35 pm

To bad i am so late, i ve found the threads, very interesting.

There are serveral levels of colour mixing in defcon, i am talking only about the tinting of the unit.bmps with team colours.

Its definitiv not additiv, because you cant add anything (for example)to red to make it yellow or white. You can call it subtractive, but the german wikipedia entry states (sadly not the english one), that actually a multiplication happens. Thats also what happens to the values of the RGB channels, they are multiplicated not subtracted.
You are right, there is shiny cruft left and non primary colours are difficult. But i think i can work out an example with 2 distinct unit types, where 3 teams (or 2vs4) share the same icons.
User avatar
rus|Mike
level5
level5
Posts: 2750
Joined: Thu Jun 28, 2007 5:52 pm
Location: Russia, St. Petersburg

Postby rus|Mike » Wed Nov 05, 2008 5:41 pm

trickser wrote:?
help?
help what?
world peace? climate change? financial crisis?

I often read here someone wants to make a USSR vs USA mod, or Starwars Rebels against Imperium or something like that. Then someone comes and says sorry, its not possible to have distinct units for every player color. But it is and i want to show that.

I get it now. No need to worry. Relax, take few deep breaths.
User avatar
trickser
level5
level5
Posts: 1826
Joined: Thu Mar 06, 2008 2:15 pm
Location: The Senate ; GMT+1
Contact:

Postby trickser » Thu Nov 06, 2008 6:57 am

Yep, its crap, but i had to try it myself. :roll:

Here is the result:
Image

Here we have red,yellow and orange TIE-Fighters; blue and turq X-Wings and green Somethings. The blueish stuff could be brighter, but i tested on a blue backround, so i toned them down. The backround adds to the colour mix and it looks best on black. Preferable for a space mod anyway.

If u wanna try, use this:
Image
User avatar
jamo
level2
level2
Posts: 92
Joined: Wed Oct 29, 2008 11:11 pm
Location: Sofia, Bulgaria
Contact:

Postby jamo » Fri Nov 07, 2008 11:34 pm

So that means, each colour team has different bmp images: that's very interesting. You are making sides. That's wonderful. Could you show me the details. I would like to add different bmp images for all coloured sides in Warhead. I'm still working on it.
User avatar
trickser
level5
level5
Posts: 1826
Joined: Thu Mar 06, 2008 2:15 pm
Location: The Senate ; GMT+1
Contact:

Postby trickser » Fri Nov 07, 2008 11:57 pm

jamo wrote:So that means, each colour team has different bmp images

Unfortunately not, i will post details tomorrow.

You can convert the last image to a unit.bmp and see how it looks in game. Its not that convincing in game. Just try it yourself.
User avatar
xander
level5
level5
Posts: 16869
Joined: Thu Oct 21, 2004 11:41 pm
Location: Highland, CA, USA
Contact:

Postby xander » Sat Nov 08, 2008 1:28 am

jamo wrote:So that means, each colour team has different bmp images: that's very interesting. You are making sides. That's wonderful. Could you show me the details. I would like to add different bmp images for all coloured sides in Warhead. I'm still working on it.

It isn't that each side has its own units, it is that the single unit icon can be created in such a way that it looks different for different teams. Basically, it works like this:

Color in Defcon is subtractive. By default, each unit has an icon, in the form of a .bmp image, that is composed of a white unit on a black background. When Defcon goes to put that unit into the game, it subtracts color values from it to give it the right color. For instance, if I am on the red team, then Defcon will subtract all of the blue and green from the icon to create a red unit (actually, it only takes out most of the blue and green, but you get the idea). If you know how different wavelengths of light create color, this is pretty easy to understand, so, a refresher.

There are three primary colors of light: red, green, and blue. If you look very closely at a CRT monitor, you can see that every pixel is made up of three little lights: a red one, a green one, and a blue one. To make other colors, you combine red, green, and blue (R, G, B, respectively) to create new colors. Let us say that each value can go from 0 to 7. Black is the color R0 G0 B0 (that is, zero for each color), while white is the color R7 G7 B7. Yellow is made by combining red and green, so is given by R7 G7 B0.

Okay, so suppose that you have a white pixel (R7 G7 B7) and you want it to be red. Well, you need to subtract out everything that is not red. So, you subtract cyan (R0 G7 B7). White minus cyan equals red (consider the color designation to be a 1x3 matrix, and subtract as you would normally subtract a matrix). But, what happens if I have a pixel that is the color R3 G7 B2, and I subtract cyan? First off, we don't deal with negative numbers -- if a subtraction comes out negative, we just set it to zero. So, when we subtract cyan, we get R3 G0 B0, which is a dark red color.

Now, how does this help us? Let us say that we have only two possible teams -- red and blue. In order to make red, we subtract out blue and green; and in order to make blue, we subtract out red and green. So, if a pixel is the color R7 G0 B7 (magenta), and the unit is on the red team, then we end up with red. If, on the other hand, we have the same pixel, but the unit is on the blue team, then we subtract the red, and end up with blue.

If you have a unit icon that includes pixels that are magenta, blue, and red, then the magenta pixels will show up for both teams, the red pixels will show up only for the red team, and the blue pixels will show up only for the blue team. In the Star Wars sprite above, notice that the tie fighter is in red, and the x-wing fighter is in blue. The places where they overlap are cyan(ish -- they are actually white, but you could do a better job of editing the image to get it right). Thus, it looks like a tie fighter on the red team, and an x-wing fighter on the blue team.

One image, but it looks different depending on the team. With an appropriate image editor you can do the same. However, there are pitfalls. There are teams that use more than one primary color (the yellow, orange, and teal/cyan teams). Thus in the x-wing/tie fighter sprite above, the overlapping portions (the cyan bits) will be cyan on the cyan team, while the blue bits will be blue (see the image of all of the units, lower-right corner). This can lead to confusing or ugly units. Also, you have no guarantee that you will stick with one color throughout the game. Thus, all of your tie fighters might magically transform into x-wing fighters in the middle of the game, which would be weird.

Thus, playing with the colors of the sprites can give some interesting results, but most of us dismissed it as an interesting but useless exercise several years ago. You are welcome to experiment, and I encourage you to do so, but, in practice, it doesn't work very well.

xander
User avatar
trickser
level5
level5
Posts: 1826
Joined: Thu Mar 06, 2008 2:15 pm
Location: The Senate ; GMT+1
Contact:

Postby trickser » Mon Nov 10, 2008 12:34 pm

I will try to explain this with Defcon in mind, but it will not become much easier, because the facts are basicly the same.

1. Digital images and colors

Digital images are made of 3 primary colors: Red, Green and Blue. I call them R/G/B channels.
Image
You can think of them as 3 greyscale images, where every image represents a color. Every pixel has a value between 0 and 255. 0 means perfect black and 255 means maximum brightness.
You can see the tomatos are very bright on the red channel but dark on green and blue. The yellow orange(the fruit) pieces are bright on the red and green channels, because yellow is a mix of red and green.

2. Team colors and unit images

Image

These are the Team colors and thier RGB values. At least, its what i have measured.
These 50s will cause dull shadows of the other image (see 1. image in thread), but to make any progess, i will think of them as 0s. On a black backround, these shadows are not too obvious.

So how do team colors and unit images interact?

As an equation it looks like this:
R(team_color)*R(unit_image)/255=R(in_game)
Same for G and B


I like to think of unit images as a filter to the team color. Have a look at the following chart.

Code: Select all

        channels|Red    |Green  |Blue   |
team_colors     |       |       |       |
----------------------------------------
Red             | 200   |  50   |  50   |
Green           |  50   | 200   |  50   |
Blue            |  50   |  50   | 255   |
Orange          | 255   | 150   |   0   |
Yellow          | 200   | 200   |  50   |
Turq            |   0   | 200   | 200   |
-----------------------------------------
Pixels in unit
Images
White pixel     | 255   | 255   | 255   |
Grey pixel      | 150   | 150   | 150   |
----------------|-------|-------|-------|
Red pixel       | 255   |   0   |   0   |
Green pixel     |   0   | 255   |   0   |
Blue pixel      |   0   |   0   | 255   |


A white pixel will let every color component pass. A red pixel lets only pass the red componet of a color. Only red, orange and yellow have a red component. So a red pixel will only show up in the red, orange and yellow teams.
A blue pixel will show up in the blue and turq teams. While a green one shows up on every team but red and blue.

Red and blue components are independent of each other, means there is no color, that has a red and a blue component. (reminder: i treat 50s as 0s)

3. How to make 2 distinct partys

Lets take avantage of the independence of red and blue by making the models red and blue. Then combine the models to one image.
Image

Now red, orange and yellow teams will see the TIE-Fighter and blue and turq the X-Wing. Well that was the easy part, now the real trouble starts.

2 problems:
1. The green team has no model. If you make a green TIE, it will show up in the turq team together with the X-Wing. If you make a green X-Wing it will show up on yellow and orange together with a TIE.
2. While red,orange and yellow show a TIE, they all just use the red component. The model will be red, no matter what your actual team color is. Same problem with blue, turg and the X-Wing. Because yellow, orange and turq miss the green component.

Well, this was my solution, not perfect, but something.
Image


I cut both images with each other, so only the common parts are left. Then i color it green and add it to the composite.
For the white part of the composite, each team will have its real color. And the green team has some kind of a model, that might remind you of a TIE or a X-Wing.
For this method its important the 2 models overlap as much as possible. The best solution of that kind would be a blue model totally fiting inside the red one. But TIEs and X-Wings are shaped too different.

4. How to make 6 distinct partys

I didnt wasted too much brain power on this one. But i guess the way to go, would be, to have parts of a model, you can combine in many ways, and that still would make sense.
Something like this:
Image

Thats all folks. :wink:
And thats all just theorie, you still need a good image editor (hint:The Gimp) and the knowledge to use it.

Return to “Mod Projects”

Who is online

Users browsing this forum: No registered users and 1 guest