Translations in image's own palette

Remember, just because you request it, that doesn't mean you'll get it.

Moderator: GZDoom Developers

Talon1024
 
 
Posts: 374
Joined: Mon Jun 27, 2016 7:26 pm
Preferred Pronouns: He/Him
Graphics Processor: nVidia with Vulkan support
Contact:

Translations in image's own palette

Post by Talon1024 »

PNG files can be 8-bit, and contain their own embedded palette. The game uses the PLAYPAL for translations. If a sprite or texture with a true-colour or paletted image (that uses a palette different from the PLAYPAL) is given a translation, the game converts the image to paletted format, and then performs the translation.

It would be nice if people could make colour translations using the image's own palette. Some advantages of this approach are:
  • Mods that support multiple IWADs, and contain new player sprites wouldn't have to have different versions of the player sprites for each IWAD.
  • Some modders could save space by using translations to create new textures from their existing textures.
  • Doom 64-style palette animations
And some pseudocode:

Code: Select all

If an image contains its own palette
  If the translation is flagged to use image's palette rather than the PLAYPAL
    Perform the translation using the image's colours
Otherwise
  Perform the translation using the PLAYPAL

If the renderer does not support true-colour rendering
  Convert the translated image to the PLAYPAL
Otherwise
  Leave the translated image as-is
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49073
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Translations in image's own palette

Post by Graf Zahl »

Technically this won't be too hard, the main blocker is more logical than technical. The current translation system sits outside actual texture management and solely operates on the paletted output options. This would essentially mean to create new textures for each translation so that the engine can handle them.

That means that defining a texture with an external palette would easily be doable through TEXTURES, but having on-the-fly translations on per-image palettes in-game is a bit problematic.
Post Reply

Return to “Feature Suggestions [GZDoom]”