Page 1 of 1
Player sprite color
Posted: Sat Jan 09, 2010 15:21
by milasudril
It seems like GZDoom does not support true-color for player sprites while other true-color sprites works. Is that true?
Re: Player sprite color
Posted: Sat Jan 09, 2010 15:42
by Gez
GZDoom supports true color for all sprites.
Re: Player sprite color
Posted: Sat Jan 09, 2010 16:05
by milasudril
What do you say about that?
It looks like something is wrong, does it?
Re: Player sprite color
Posted: Sat Jan 09, 2010 16:29
by InsanityBringer
Was it imported as a high color PNG? Remember that some wad editors (XWE) will convert PNGs to the classic paletted doom format unless you tell it not to (Load (Raw Data))
Also, check your player color
Re: Player sprite color
Posted: Sat Jan 09, 2010 16:46
by milasudril
InsanityBringer wrote:Was it imported as a high color PNG? Remember that some wad editors (XWE) will convert PNGs to the classic paletted doom format unless you tell it not to (Load (Raw Data))
In SLumpEd it looks correct
InsanityBringer wrote:Also, check your player color
How should I set the player color to make it untouched?
Re: Player sprite color
Posted: Sat Jan 09, 2010 16:55
by InsanityBringer
milasudril wrote:
InsanityBringer wrote:Also, check your player color
How should I set the player color to make it untouched?
Define a new player class (see [wiki]Classes:PlayerPawn[/wiki] at the zdoom wiki), and don't set Player.ColorRange to anything. If you want to inherit from the DoomPlayer class, you'll need to set Player.ColorRange to something like 0 0
Re: Player sprite color
Posted: Sat Jan 09, 2010 17:33
by milasudril
InsanityBringer wrote:milasudril wrote:
InsanityBringer wrote:Also, check your player color
How should I set the player color to make it untouched?
Define a new player class (see [wiki]Classes:PlayerPawn[/wiki] at the zdoom wiki), and don't set Player.ColorRange to anything. If you want to inherit from the DoomPlayer class, you'll need to set Player.ColorRange to something like 0 0
It looks still wrong. This one gives a more clear example:

Re: Player sprite color
Posted: Sat Jan 09, 2010 18:10
by Enjay
There does seem to be something odd going on. Regardless of whether I inherit from DoomPlayer and employ the "Player.ColorRange 0, 0" trick or whether I defined a class that inherits from "PlayerPawn" and leave out the color range completely, my player sprite seems to get forced into 256 colours (and it looks like the 256 colours are indeed the Doom palette [edit] Confirmed, in other games it uses colours from their palette[/edit]).
Using this as a player sprite:
I get this when I start a game:
but in a game with chasecam on it looks like this:
and even in the menu once a game has started it looks like this:
The question is, is this a bug or is it by design?
Re: Player sprite color
Posted: Sat Jan 09, 2010 18:27
by milasudril
Things seems to become right after a call to MorphActor.
After that, the sprite looks good (if the player not already is of class xxx. This looks like a bug.
Re: Player sprite color
Posted: Fri Jan 15, 2010 20:02
by Graf Zahl
Player sprites have a translation forced upon them. Unless ZDoom finally implements the often suggested 'do not translate' feature I can't do much about it. It's simply not possible to decide whether the translation is bogus or not.
Re: Player sprite color
Posted: Sun Jan 17, 2010 19:35
by milasudril
Graf Zahl wrote:Player sprites have a translation forced upon them. Unless ZDoom finally implements the often suggested 'do not translate' feature I can't do much about it. It's simply not possible to decide whether the translation is bogus or not.
What about
according to the ZDoom wiki, this implies no translation. What about the MorphActor hack?
I do not know how the translation works, but one way to do it in indexed mode is to replace some predefined (I guess the color index to replace is selected by the ColorRange property) colors in the palette. When the sprite is true-color, this solution does not work. Because it is known that the PNG is true-color you can decide to not translate using this algorithm.
For a true-color sprite it is a better idea to replace all pixel that have a color in the HSL or HSV space within the neighbourhood of a predefined color ignoring L/V. That is, replace all colors that has a similar hue and saturation as the color to replace and set them to the hue and saturation of the replacing color. The lightness/value component of the original color is then multiplied by the lightness/value component of the replacing color. This algorithm will work for both indexed and true-colored sprites but requires probably a new PlayerPawn property.
Re: Player sprite color
Posted: Sun Jan 17, 2010 19:55
by Graf Zahl
Even if there's no color range the translation is still there