Jump to content

[WIP] Loading textures only as required


Faark

Recommended Posts

--Regarding the 64 bit KSP thing--

From a tech point of view i'm not sure whether the current version of Lod would run under 64bit. Most likely not, but changing that shouldn't be that hard and would ofc take away any kind of memory pressure this plugin had.

I have sort of unofficially tested this and LOD didn't work with it. I realize that's incredibly vague, but it gave an error on startup about failing to create NativeBridge. A truncated output log is below, if you really want the full one I can get it to you, but I just wanted to let you and others know that they don't work together, in my test at least.

This was meant more as a "Hey it didn't work, fyi" instead of a "Fix it but I'm not going to give you any details to help". You said yourself it probably wouldn't work :P

LoadOnDemand: Device: Direct3D 9.0c [nvd3dumx.dll 9.18.13.3788]

(Filename: C:/BuildAgent/work/d3d49558e4d408f4/artifacts/StandalonePlayerGenerated/UnityEngineDebug.cpp Line: 53)

LoadOnDemand: ERROR: Native load failed with error code 193.

(Filename: C:/BuildAgent/work/d3d49558e4d408f4/artifacts/StandalonePlayerGenerated/UnityEngineDebug.cpp Line: 53)

AggregateException: Failed to create NativeBridge, even legacy mode!Contained exceptions:

---------------------------------------

System.Exception: Failed to load native library: ---> System.Runtime.InteropServices.COMException (0x800700c1):

at System.Runtime.InteropServices.Marshal.ThrowExceptionForHR (Int32 errorCode) [0x00000] in <filename unknown>:0

at LoadOnDemand.UnmanagedLibrary..ctor (System.String fileName) [0x00000] in <filename unknown>:0

--- End of inner exception stack trace ---

at LoadOnDemand.UnmanagedLibrary..ctor (System.String fileName) [0x00000] in <filename unknown>:0

at LoadOnDemand.NativeBridge.SetupNativeBridge () [0x00000] in <filename unknown>:0

---------------------------------------

System.NotImplementedException: Legacy mode isn't even close to a working state!

at LoadOnDemand.NativeBridge.SetupNativeBridge () [0x00000] in <filename unknown>:0

at LoadOnDemand.NativeBridge.SetupNativeBridge () [0x00000] in <filename unknown>:0

at LoadOnDemand.NativeBridge.Setup (System.String cache_directory) [0x00000] in <filename unknown>:0

at LoadOnDemand.Logic.Startup.Awake () [0x00000] in <filename unknown>:0

UnityEngine.GameObject:Internal_AddComponentWithType(Type)

UnityEngine.GameObject:AddComponent(Type)

AddonLoader:StartAddon(LoadedAssembly, Type, KSPAddon, Startup)

AddonLoader:StartAddons(Startup)

Link to comment
Share on other sites

I have this weird problem where b9 cockpits are missing transparency (this also happens for the Mk2 cockpit internals mod). basically they are just grey walls. any workaround for this? btw, great mod it really improved my ksp experience, many thanks.

Link to comment
Share on other sites

I have this weird problem where b9 cockpits are missing transparency (this also happens for the Mk2 cockpit internals mod). basically they are just grey walls. any workaround for this? btw, great mod it really improved my ksp experience, many thanks.

Are you sure you're using the latest version? Cause I had the same thing with 2.2 but v3 seems to have fixed it...

Link to comment
Share on other sites

1920x1080, textures are at half res, no ATM, no custom textures.

here is a screenshot of my game data folder

here is my LOG file

Try deleting your Load On Demand cache folder. That might fix any transparency issues as all textures will get re-compressed (or whatever LOD does) and new thumbnails will get made for them on the next load.

If that doesn't help... I can't really help you further...

Link to comment
Share on other sites

I have this weird problem where b9 cockpits are missing transparency (this also happens for the Mk2 cockpit internals mod). basically they are just grey walls. any workaround for this? btw, great mod it really improved my ksp experience, many thanks.

I'm getting this too with the Kerbonov cockpit. It's painting the window frames and the glass texture is there (smudges, scratches) but the "outside" is a solid dark/black. Is this similar to the alpha transparency issue as on the sensor boom a page or two back?

Link to comment
Share on other sites

I have sort of unofficially tested this and LOD didn't work with it. I realize that's incredibly vague, but it gave an error on startup about failing to create NativeBridge. A truncated output log is below, if you really want the full one I can get it to you, but I just wanted to let you and others know that they don't work together, in my test at least.

This was meant more as a "Hey it didn't work, fyi" instead of a "Fix it but I'm not going to give you any details to help". You said yourself it probably wouldn't work :P

Yes, i had to compile a specific part as 64bit, as expected. Here is a 64bit version that seems to work fine on my machine. You probably need the 64bit redist as well for it. Hope there isn't anything else missing.

[..]

Thanks, downloaded the logs, will inspect them tomorrow.

@Transparency issues: Has someone tested those parts with only a stock install, the particular mod of that broken transparency part and LOD? Hope i'll have time to investigate it tomorrow as well.

Link to comment
Share on other sites

My game crashes after returning to the VAB/SPH right after reverting a flight. It loads the textures of the parts and at the last part (or a short time after that) the game crashes. I.e. I can witness all the little placeholders getting replaced by the proper textures in the editor but right after that... CTD.

Logs here: https://mega.co.nz/#!FAFgFDZa!FQRyPW4IensIeV0-p87JejWpbczquo6mlEmw7IvwMCA

My installation includes a ridiculous amout of mods including TR, I've deactivated Compression and Mipmap generation though and don't use it to replace Stock textures (I hard-replaced the stock textures instead).

Edit: Oh and I also got the issue with transparency, maybe it can be solved by converting the B9, or whatever, textures to another format first? Some pages ago someone advised something along those lines.

Link to comment
Share on other sites

@Transparency issues: Has someone tested those parts with only a stock install, the particular mod of that broken transparency part and LOD? Hope i'll have time to investigate it tomorrow as well.

Thanks Faark --

I ran KSP with only vanilla assets, the KN-2 cockpit (http://forum.kerbalspaceprogram.com/threads/66502-Kerbonov-Kn-2-Cockpit-Module) and a fresh copy of the LoadOnDemand.dll in the gamedata folder (so it would re-generate the folder and thumb files). Vanilla cockpits are fine, but the KN-2 still has the black windows.

Link to comment
Share on other sites

Yea, the transparency of that window is indeed broken because of that stupid TGA loader that doesn't "find" any alpha channels. I'll see what i can do. There was some discussion earlier about converting them to PNG as temporary workaround.

Link to comment
Share on other sites

I tried the 64bit Player hack, and the game crashes but not to memory problems, and there seems to be no work around so I stay with our awesome LOD mod and 32 bit. Which during the last days had no crashes due to tga problems only it ran oom.

Link to comment
Share on other sites

Yea, the transparency of that window is indeed broken because of that stupid TGA loader that doesn't "find" any alpha channels. I'll see what i can do. There was some discussion earlier about converting them to PNG as temporary workaround.

So I tried an experiment (and truly a shot in the dark, since I know relatively little about image formats) -- opened up the transparency tga in photoshop and the alpha channel visibility was off. I ticked it on, re-saved the file and voila! it now works in-game. The file is now also about twice the size, so I'm not sure that's a true fix, but it at least points to the precise problem.

Link to comment
Share on other sites

Beetlecat: the key point is that you resaved the file via Photoshop and therefore it was written by Photoshop rather than whatever program originally wrote the TGA.

However, that *does* make me wonder if the issue is indeed related to the RLE encoding compressed TGAs use, since you mentione when you resaved it (and presumably had "compress" unchecked) the file size went up.

Faark, any thoughts on that?

Link to comment
Share on other sites

Beetlecat: the key point is that you resaved the file via Photoshop and therefore it was written by Photoshop rather than whatever program originally wrote the TGA.

However, that *does* make me wonder if the issue is indeed related to the RLE encoding compressed TGAs use, since you mentione when you resaved it (and presumably had "compress" unchecked) the file size went up.

Faark, any thoughts on that?

Well yeah. Editing it was my only option short of asking the author to "do something different" ;). I was curious to see how that cockpit differed from something like from B9 or other that already worked fine. PS offered 16/24/32bit, along with a RLE compression option (which I never checked) and only saving it as 32b ultimately worked, thus the larger file size. I'm guessing now that the "visible" alpha channel selected was less important than the least compressed format.

Aside from couple of visual glitches--and my own explorations into the world of .tga, LOD seems to be working great, and I'm wondering if/why more people aren't trying this out yet.

---Wait a second. I tried a B9 cockpit and it was fine?! I'm using the .23.5 "fixed" version on curse if that makes any difference.

Link to comment
Share on other sites

I don't really want to know anything about TGA file formats, to be honest. That is why i am using external code to take care of that and it seem to handle quite a few cases. I have no idea who is breaking the format rules (and frankly don't want to know), but this mod a. has to load those apparently somewhat frequently used TGAs properly and b. most other loaders i've found on the net and could switch to seemed to be very "limited", thus also not an optimal solution.

Instead I now have modified the current loader to default to Argb for 32bpp TGAs. We'll see whether this breaks sth else... please leave a note in that case.

[..]

Thanks again for the reports, it should be fixed with the next version.

Actually, here it is: LOD 3.1 - TGA transparency fixed, Parts not loading fixed

Link to comment
Share on other sites

Just tried out the newest version, and it throws me an error at the main menu "Load on Demand has encountered a problem and may not work properly. Object reference not set to an instance of an object." (or something similar).

Previous version was working fine for me, so I'll revert to that for now.

Brilliant effort by the way - I could grow a beard in the time it used to take to load KSP with ATM without using this...

Edit: Tried again and got the same error at the main menu. Loaded a game, went to VAB. Parts list full of purple check textures. However, LOD then appears to prepare all the textures OK and load them fine, so maybe it's not that big an issue...

Edited by UnanimousCoward
Link to comment
Share on other sites

Just tried out the newest version, and it throws me an error at the main menu "Load on Demand has encountered a problem and may not work properly. Object reference not set to an instance of an object." (or something similar).

Previous version was working fine for me, so I'll revert to that for now.

Brilliant effort by the way - I could grow a beard in the time it used to take to load KSP with ATM without using this...

Always get rid of your LOD cache when you're updating this mod.

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...