-
Notifications
You must be signed in to change notification settings - Fork 230
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
Convert all textures to .DDS; shrinks mod size by 73% #2389
Conversation
-adding DDS textures -adding modified kOSMachine0mLegacy part .cfg, that redirects the part to use the textures of the kOSMachine0m
Delete MBM files
- Resized GFX UI textures to power of two, to stop unecessary log spam - Removed unecessary toggle_source.psd from /GameData, and moved to gimp folder in asset source folder
Update part.cfg to reflect bulkhead profile addition
By the way, in the future it's best to make a separate branch for your PR, rather than just using the default name of "StoneBlue/develop". Presumably if you made other changes while this PR was pending they'd have ended up melted together with it. Luckily you hadn't so it's fine in this case. |
I'm not sure it is possible for me to test the Legacy part anymore at this stage. I don't have any savegames from that long ago that would still have had the legacy part in them. But for that very reason, I'm okay with not testing the legacy part. The only people who will have one in their game are people trying to play a save from over 2 years ago who haven't played since. |
@StoneBlue - would you have any insight into this: As of v1.1.6.1 (which has this PR in it), I got a report that icons that used to work are now coming up black for one user (but not others). I noticed someone (was it you) mentioned widthXheight needing to be powers of 2, but this PR didn't actually do that. It did edit all the PNGs, but many of them still had heights that were not powers of 2. |
@StoneBlue One thing just occurred to me that might have happened here. Your text describing this PR claims you changed ALL textures to DDS, but the actual changes in the PR do not show that. Many of the files are still PNG. Perhaps you did actually generate DDS files for all of them but hadn't done a |
@Dunbaratu Terribly sorry.. I have been away from my KSP development computer for a couple weeks, and have only been infrequently checking the forums on a tablet. Well, I must apologize... I DID say "all" textures... That was not a good choice on my part. So while I did slightly resize quite a few of the GUI textures to fit the power of two rule, mainly to cut down on log spam, I did leave them all as .png on purpose, so as not to introduce any unforeseen issues with a full format change, due to my lack of specific knowledge with GUI textures. You just need to go back to using the .pngs in the GFX folder in the PR. |
Are you operating under the impression that this was the order of events? 1 - I merged your PR. With the icons resized but still PNG. Because that isn't what happened. At all. It was in this order: 1 - I merged your PR. With the icons resized but still PNG. It worked in my testing. The PNGs in the original PR started the problem. |
I have an idea about what might have happened here. But the issue is so convoluted I don't know if I have it right. For one thing I saw other reports on this issue (I had to go do a lot of reading too after this) claiming that powers of 2 aren't what you need to convert to DDS, just multiples of 4 (thus the change from 27 pixels to 28 would be significant, while if it was keyed on powers of 2 it would not). So in testing the mess I also found another fact that's important: KSP attempts to convert all mod's PNG textures into DXT5 compression upon loading them into GameDatabase.Instance. So even when we ship PNG files, it will try to make them into DXT5 compressed format when loading them if it can. And I think that's where the file size changes triggered something. By making the PNGs into a multiple of 4 (28 pixels high when it was 27, for example), you made it possible for KSP to attempt this conversion when before it gave up because the size didn't match. Therefore if you want to ensure that the GUI textures remain as PNG, you have to make them not compressable, which means NOT a nice multiuple of 4. Exactly the opposite of the advice everyone keeps giving. They won't stay as PNG unless we can befuddle KSP's attempt to convert them automatically by deliberately NOT making them a convertable size. It may turn out that those errors you saw about the failure to convert were actually a GOOD thing and we didn't know it. Because the conversion doesn't seem to work right on some installations, and I suspect it's because when KSP does it at runtime it ends up using the graphics card to do it, and that's what makes the results driver-dependant. By converting to DDS w/DXT5 myself I bypassed the (apparently quite buggy) step where the game tries to do it at runtime. There is another potential fix. We can just bypass KSP's GameData.Instance loader entirely here and just obtain the textures ourselves instead, and entirely bypass the game's attempt to compress to DXT5 (which is what causes the bugs it seems). That seemed to have worked in the past. We used to do this for a few of the files and I just got done changing all that code over to using GameDatabase.Instance.GetTexture() instead as part of the DDS change in v1.1.6.2. Maybe the fix, instead of moving everything into GameDatabase.Instance.GetTexture(), is to move everything out of it, so it stops trying to invoke its broken conversion into DXT5. We can call the Unity texture loading directly and explicitly tell it that it's okay to leave the files uncompressed. The Terminal code used to do it that way before v1.1.6.2 where I made everything DDS and also moved everything to GameDatabase.Instance. I could make the ToolbarWindow code do the same thing and have it stop using GameDatabase.Instance too. |
By converting the textures, the folder size of the mod is decreased from 37.3MB to 8.76MB
Also, some tiny performance gain may be had in KSP, by using the .dds format