LDraw.org Discussion Forums
Translate old colour codes - Printable Version

+- LDraw.org Discussion Forums (https://forums.ldraw.org)
+-- Forum: Models and Parts (https://forums.ldraw.org/forum-18.html)
+--- Forum: Parts Authoring (https://forums.ldraw.org/forum-19.html)
+--- Thread: Translate old colour codes (/thread-15259.html)

Pages: 1 2


Translate old colour codes - Magnus Forsberg - 2015-01-22

Many old parts use a blended colour code. A mix of two ldraw base colours.
New parts can have a RGB-based colour code
Both are ways to create a colour not present in ldconfig.ldr

Is there a way to 'translate' the old code to a new code?


Re: Translate old colour codes - Roland Melkert - 2015-01-22

Yes, you only need to calculate the RGB of the dithered color code by applying the known base colors from the LDConfig, like so (c++ pseudo)

Code:
A=(code-256) >> 4
B=(code-256) & 0x0F

r=(A.r+B.r)/2.0
g=(A.g+B.g)/2.0
b=(A.b+B.b)/2.0

edit: forgot the -256


Re: Translate old colour codes - Philippe Hurbain - 2015-01-23

Color on printed stuff is so imprecise (pigment mismatch, plastic color bleeding through and so on) that I think the best way is to visually match color with an existing ldconfig color. Don't forget also that initial dithered color was eyeballed too, probably using an uncalibrated monitor to match color...


Re: Translate old colour codes - Magnus Forsberg - 2015-01-23

Thanks Roland, but I don't speak 'code'. I don't even know how to read that math.
Is there a tool that can do that calculation? ColourManager?

I'm reworking many of the torsos from the early Pirates. They all need to become BFC compliant.

All files use the same code 486. Some sort of light brown leather. But all the pictures show different shades of brown, as Philo says.
Reddish brown is to dark. I think I'll go with Medium Dark Flesh

   


Re: Translate old colour codes - Max Martin Richter - 2015-01-23

I understand the code in the following way:
To get the new value for red/green/blue you have to sum the red/green/blue values and divide it by two.

An example:
You want to mix the LDraw-Colours blue (1) and Orange (25)
RGB of blue: 0055BF
RGB of orange: FE8A18

Now take the first to positions: 00 and FE -> sum is FE -> divide by two makes 7F
Now position three and four: 55 and 8A -> sum is DF -> divide by two makes 6F
Now position five and six: BF and 18 -> sum is D7 -> divide by two makes 6B

New colour is 7F6F6B

Please note that the windows calculator can handle hex data in the programmer mode (Win Vista and Win 7).

/Max


Re: Translate old colour codes - Max Martin Richter - 2015-01-23

I just programmed a small tool for this purpose
Comments are welcome (a symbol as well).

/Max


Re: Translate old colour codes - Philippe Hurbain - 2015-01-24

Quote:RGB of blue: 0055BF
RGB of orange: FE8A18
That's current definition of blue and orange per ldconfig, but certainly not the RGB values of EGA/VGA era when this mix was defined... And it would be nice if the tool computed the closest ldconfig color.


Re: Translate old colour codes - Max Martin Richter - 2015-01-24

Yes, this would be an idea... I have to think about this, cause my programming skills are a bit limited. Anyway, I'll give it a try the next days...
Okay, I have a basic idea on how to do this...

/Max


Re: Translate old colour codes - Magnus Forsberg - 2015-01-24

Thanks a lot, it works fine.

Maybe some sort of blended colour wheel?


.png   blended01_64x64.png (Size: 10.16 KB / Downloads: 0)


Re: Translate old colour codes - Max Martin Richter - 2015-01-24

Is there any copyright on this colour wheel?

/Max