-
Notifications
You must be signed in to change notification settings - Fork 227
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
Add support for games that use DDS textures #1929
base: master
Are you sure you want to change the base?
Conversation
(cherry picked from commit de9476c)
Download the artifacts for this pull request here: GUI:
CLI: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small nitpicks, but looks good on the whole. Ideally before merging completely, we should investigate the feasibility of encoding the BCN format (assuming ImageMagick doesn't fully support it?).
UndertaleModLib/Util/GMImage.cs
Outdated
{ | ||
// Read entire image | ||
reader.Position = startAddress; | ||
return FromDds(reader.ReadBytes((int)(maxEndOfStreamPosition - startAddress))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If possible, we should be finding the length of the image data using the image contents, rather than using maxEndOfStreamPosition
, which can result in unnecessary padding when re-saving with modifications.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Didn't think about that! Sadly there's no easy way to find the length in this format. I changed it so it can get the size of file but only without the extra bdata2 field, because getting that is even harder.
UndertaleModLib/Util/GMImage.cs
Outdated
return new GMImage(ImageFormat.Dds, width, height, data); | ||
} | ||
|
||
private void AddMagickToPngSettings(MagickReadSettings settings) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unsure if this is going to stick around in the long run, but this can probably be marked static
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Totally
There is another file extension that was never mentioned before. (e.g. |
@sonic3XE Could you send a game that uses it, or tell which custom option and OS creates such format, so it can be tested? |
@luizzeroxis |
GPU-compressed textures are referred as #1932 including DDS, ASTC, and GNF. |
Description
Fix #1907
Some games use the official GM-GPUTextureCompression extension to use GPU compressed textures. One of the formats supported is BCN compression, which uses the DDS format, at least on Windows. This PR aims to allow games using that to be modded.
Caveats
Although you can load it, there's no support for saving these textures in their original format, so it just saves in PNG format and gives a warning to the user. This works, but obviously will have a performance impact. This compression format is lossy anyway.
Notes
There's other formats supported by this extension, and in other operating systems, hopefully this can be addressed in future PRs.