Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include new DDS Headers for 4bpp (16 colors palette) & 8bbp (256 colours palette) textures #281

Closed
Poodmund opened this issue Mar 31, 2018 · 2 comments

Comments

@Poodmund
Copy link

Add in additional DDS Header information to allow for dds textures to be used in the following formats:

  • palette RGB 4bpp 16 colors
  • palette RGB 8bpp 256 colors

... to allow for usage in textures such as high-resolution biome maps that have a very low footprint.

Discussion from Sigma88:

basically, byte 88 has the information about bpp (4 or 8)(edited)
as all dds files they have a 128 header
if you remove the header you are left with the image which is split in two parts
1- the color palette
2- the actual texture
the color palette has 4 bytes (RGBA) for every color(edited)
so 4bpp images have a 64 bytes palette
8bpp images have a 1024 bytes palette
the actual texture has 1 byte every 2 pixels (4bpp images) or 1 byte for every pixel (8bpp images)
and experimental code: https://pastebin.com/7iJmUV97

@Sigma88
Copy link
Contributor

Sigma88 commented May 10, 2018

EDIT: updated, see next comment

@StollD I've implemented the palettedds loader here 388097a

the code is not very optimized with Kopernicus, but it should work correctly as far as I understand it.

however, I am having some troubles with it....

to check that the texture is loaded correctly, I encode it to PNG and save it to disk.

the image saved to disk has the correct colors, however ingame the planet just looks blank (white)

here is a quick setup you can test to see the mod running

PaletteLoaderTest.zip

and this is the output_log (it contains some log entries I put there to check the properties of the texture, you can ignore them)

output_log.txt

@Sigma88
Copy link
Contributor

Sigma88 commented May 10, 2018

it seems I was able to fix all the issues

@StollD the code now works, but it looks very ugly. if you want to clean it and make it more consistent with the rest of kopernicus, feel free to do that.

or even just tell me what to change

Sorry, something went wrong.

@Sigma88 Sigma88 mentioned this issue May 15, 2018
@StollD StollD closed this as completed in 8d21173 May 15, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants