Built-in translations seem very dark

Ask about editing graphics, sounds, models, music, etc here!
Shaders (GLSL) and SNDINFO questions also go here!

Moderators: GZDoom Developers, Raze Developers

Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.
User avatar
Sir Robin
Posts: 537
Joined: Wed Dec 22, 2021 7:02 pm
Graphics Processor: Intel (Modern GZDoom)
Location: Medellin, Colombia

Built-in translations seem very dark

Post by Sir Robin »

I was doing something with trying to change to colors of sprites through [wiki=Translation]translations[/wiki] and I noticed they were always very dark. So I set up this test to see the effects of different translation techniques to change colors.

The rows are:
  1. Untranslated, for reference
  2. Standard translations
  3. Palette range to palette range
  4. Direct color translations
  5. Desaturated color translations
  6. Blended translations
  7. Tinted translations
and the columns are:
  • desaturated
  • blue
  • gold
  • green
  • ice
  • inverse (not all translation methods can do this one)
  • red
Use the far right column for a base-line - translation red to red should be straight forward, shouldn't notice much change. But notice that generally speaking all the translations come across pretty dark. The only decent ones are rows 3 and 4, but that's just because I got to pick the colors manually. The standard and automatic ones are much darker.

So am I not doing this right or is it just supposed to be this way?

Here's the code:

Code: Select all

texture PALCHECK, 64, 64
{
	patch "STARGR1",  0, 0

	//control group
	patch "STCFN065",  0,  0
	patch "STCFN065",  8,  0
	patch "STCFN065", 16,  0
	patch "STCFN065", 24,  0
	patch "STCFN065", 32,  0
	patch "STCFN065", 40,  0
	patch "STCFN065", 48,  0

	//standard translations
	patch "STCFN065",  0,  8 {translation "desaturate", 31}
	patch "STCFN065",  8,  8 {translation "blue"}
	patch "STCFN065", 16,  8 {translation "gold"}
	patch "STCFN065", 24,  8 {translation "green"}
	patch "STCFN065", 32,  8 {translation "ice"}
	patch "STCFN065", 40,  8 {translation "inverse"}
	patch "STCFN065", 48,  8 {translation "red"}

	//Palette range to palette range
	patch "STCFN065",  0, 16 {translation "176:191= 80:111"}
	patch "STCFN065",  8, 16 {translation "176:191=200:207"}
	patch "STCFN065", 16, 16 {translation "176:191=160:167"}
	patch "STCFN065", 24, 16 {translation "176:191=112:127"}
	patch "STCFN065", 32, 16 {translation "176:191=192:199"}
	patch "STCFN065", 40, 16 {translation "176:191=111: 80"}
	patch "STCFN065", 48, 16 {translation "176:191=176:191"}

	//Direct color translations
	patch "STCFN065",  0, 24 {translation "176:191=[255,255,255]:[ 32, 32, 32]"}
	patch "STCFN065",  8, 24 {translation "176:191=[  0,  0,255]:[  0,  0,  8]"}
	patch "STCFN065", 16, 24 {translation "176:191=[255,218,  0]:[ 32, 27,  0]"}
	patch "STCFN065", 24, 24 {translation "176:191=[128,255,  0]:[ 16, 32,  0]"}
	patch "STCFN065", 32, 24 {translation "176:191=[128,128,154]:[ 16, 16, 20]"}
	patch "STCFN065", 40, 24 {translation "176:191=[ 16, 16, 16]:[255,255,255]"}
	patch "STCFN065", 48, 24 {translation "176:191=[255,  0,  0]:[ 32,  0,  0]"}
	
	//Desaturated color translations
	patch "STCFN065",  0, 32 {translation "0:255=%[0.0,0.0,0.0]:[2.0,2.0,2.0]"}
	patch "STCFN065",  8, 32 {translation "0:255=%[0.0,0.0,0.0]:[0.0,0.0,2.0]"}
	patch "STCFN065", 16, 32 {translation "0:255=%[0.0,0.0,0.0]:[2.0,1.7,0.0]"}
	patch "STCFN065", 24, 32 {translation "0:255=%[0.0,0.0,0.0]:[1.0,2.0,0.0]"}
	patch "STCFN065", 32, 32 {translation "0:255=%[0.0,0.0,0.0]:[1.0,1.0,1.2]"}
	patch "STCFN065", 40, 32 {translation "0:255=%[0.0,0.0,0.0]:[2.0,2.0,2.0]"} //can't use negative numbers here
	patch "STCFN065", 48, 32 {translation "0:255=%[0.0,0.0,0.0]:[2.0,0.0,0.0]"}
	
	//Blended translations
	patch "STCFN065",  0, 40 {translation "0:255=#[255,255,255]"}
	patch "STCFN065",  8, 40 {translation "0:255=#[  0,  0,255]"}
	patch "STCFN065", 16, 40 {translation "0:255=#[255,215,  0]"}
	patch "STCFN065", 24, 40 {translation "0:255=#[  0,255,  0]"}
	patch "STCFN065", 32, 40 {translation "0:255=#[128,128,154]"}
	patch "STCFN065", 40, 40 {translation "0:255=#[255,255,255]"}//can't use negative numbers here
	patch "STCFN065", 48, 40 {translation "0:255=#[255,  0,  0]"}

	//Tinted translations
	patch "STCFN065",  0, 48 {translation "0:255=@50[255,255,255]"}
	patch "STCFN065",  8, 48 {translation "0:255=@50[  0,  0,255]"}
	patch "STCFN065", 16, 48 {translation "0:255=@50[255,215,  0]"}
	patch "STCFN065", 24, 48 {translation "0:255=@50[  0,255,  0]"}
	patch "STCFN065", 32, 48 {translation "0:255=@50[124,124,154]"}
	patch "STCFN065", 40, 48 {translation "0:255=@50[255,255,255]"}//can't use negative numbers here
	patch "STCFN065", 48, 48 {translation "0:255=@50[255,  0,  0]"}

}
Gez
 
 
Posts: 17937
Joined: Fri Jul 06, 2007 3:22 pm

Re: Built-in translations seem very dark

Post by Gez »

For reference, here's what it looks like in SLADE's texture editor:
Image

(I had to fix the direct color translations, though, as for some reason it didn't parse them correctly.)
User avatar
Sir Robin
Posts: 537
Joined: Wed Dec 22, 2021 7:02 pm
Graphics Processor: Intel (Modern GZDoom)
Location: Medellin, Colombia

Re: Built-in translations seem very dark

Post by Sir Robin »

Gez wrote:For reference, here's what it looks like in SLADE's texture editor:
(I had to fix the direct color translations, though, as for some reason it didn't parse them correctly.)
I'm guessing it's not displaying in true color and is snapping to the Doom palette. Still, everything looks very dark. I would expect that far right column to be more or less solid red like the top row.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49194
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Built-in translations seem very dark

Post by Graf Zahl »

The reaon for things getting darker is actually quite simple: Nearly all these work by first desaturating the patch to a grayscale version - but since the original patch is bright red that grayscale image will have its luminosity reduced to one third of the r channel. (formula is 0.3*r + 0.56*g + 0.14*b) And from there you won't get the brightness back again.

Return to “Assets (and other stuff)”