Player sprite color

Advanced OpenGL source port fork from ZDoom, picking up where ZDoomGL left off.
[Home] [Download] [Git builds (Win)] [Git builds (Mac)] [Wiki] [Repo] [Bugs&Suggestions]

Moderator: Graf Zahl

Locked
milasudril
Posts: 64
Joined: Fri May 15, 2009 17:21

Player sprite color

Post by milasudril »

It seems like GZDoom does not support true-color for player sprites while other true-color sprites works. Is that true?
User avatar
Gez
Developer
Developer
Posts: 1399
Joined: Mon Oct 22, 2007 16:47

Re: Player sprite color

Post by Gez »

GZDoom supports true color for all sprites.
milasudril
Posts: 64
Joined: Fri May 15, 2009 17:21

Re: Player sprite color

Post by milasudril »

What do you say about that?

Image

Image

It looks like something is wrong, does it?
User avatar
InsanityBringer
Posts: 137
Joined: Fri Jun 15, 2007 22:59

Re: Player sprite color

Post 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
milasudril
Posts: 64
Joined: Fri May 15, 2009 17:21

Re: Player sprite color

Post 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?
User avatar
InsanityBringer
Posts: 137
Joined: Fri Jun 15, 2007 22:59

Re: Player sprite color

Post 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
milasudril
Posts: 64
Joined: Fri May 15, 2009 17:21

Re: Player sprite color

Post 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:
Image

Image
User avatar
Enjay
Developer
Developer
Posts: 4748
Joined: Tue Aug 30, 2005 23:19
Location: Scotland
Contact:

Re: Player sprite color

Post 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:

Image

I get this when I start a game:

Image

but in a game with chasecam on it looks like this:

Image

and even in the menu once a game has started it looks like this:

Image

The question is, is this a bug or is it by design?
milasudril
Posts: 64
Joined: Fri May 15, 2009 17:21

Re: Player sprite color

Post by milasudril »

Things seems to become right after a call to MorphActor.

Code: Select all

MorphActor(0,"xxx","",0,0,"","");
After that, the sprite looks good (if the player not already is of class xxx. This looks like a bug.
User avatar
Graf Zahl
GZDoom Developer
GZDoom Developer
Posts: 7148
Joined: Wed Jul 20, 2005 9:48
Location: Germany
Contact:

Re: Player sprite color

Post 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.
milasudril
Posts: 64
Joined: Fri May 15, 2009 17:21

Re: Player sprite color

Post 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

Code: Select all

Player.ColorRange (0 0) 
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.
User avatar
Graf Zahl
GZDoom Developer
GZDoom Developer
Posts: 7148
Joined: Wed Jul 20, 2005 9:48
Location: Germany
Contact:

Re: Player sprite color

Post by Graf Zahl »

Even if there's no color range the translation is still there
Locked

Return to “GZDoom”