Jump to content

[1.0][Release-5-0][April 28, 2015] Active Texture Management - Save RAM!


rbray89

Recommended Posts

It does something, as it builds a cache in GameData\ActiveTextureManagement\textureCache

Even a broken motor may churn and blow smoke, but it's not working as it should. That's the case with ATM at the moment. Rbray will get it sorted.

Edited by Jack Wolfe
Link to comment
Share on other sites

If it helps any, I compiled the ATM source with verbose logging turned on. Here are my logs with verbose logging turned on. In both cases, I built the dll against the specific version's Assembly-CSharp and UnityEngine dlls (so the .24 versions for .24, and .25 versions for .25). There are four log files: KSP25CacheAlreadyBuilt, KSP25CacheRebuilt (I deleted ActiveTextureManager/textureCache), KSP24CacheAlreadBuilt, and KSP24CacheRebuilt (again I deleted the textureCache). The last two provide comparisons between .24 and .25 with the same or nearly same mods installed. Really neat to see how this mod works.

These are just observations, not a smoking gun.

Scenario: KSP .25, ActiveTextureManagement/textureCache was built in .24.

What I'm seeing in my logs is that a bunch of images aren't being compressed. Specifically, PNG images. As an example, I have CactEye installed, and the CactEye/Parts/Processors/Planetary3/base.png file gives the following output in ATM:

[LOG 13:05:10.916] ActiveTextureManagement: is normalmap: False [LOG 13:05:10.917] ActiveTextureManagement: originalWidth: 256 [LOG 13:05:10.917] ActiveTextureManagement: originalHeight: 256 [LOG 13:05:10.918] ActiveTextureManagement: originalFormat: DXT5 [LOG 13:05:10.918] ActiveTextureManagement: originalMipmaps: False [LOG 13:05:10.919] ActiveTextureManagement: width: 256 [LOG 13:05:10.919] ActiveTextureManagement: height: 256 [LOG 13:05:10.920] ActiveTextureManagement: format: DXT5 [LOG 13:05:10.920] ActiveTextureManagement: mipmaps: False [LOG 13:05:10.921] ActiveTextureManagement: readable: True [LOG 13:05:10.921] ActiveTextureManagement: Saved 0B [LOG 13:05:10.922] ActiveTextureManagement: Accumulated Saved 51757343B [LOG 13:05:10.948] Load(Texture): CactEye/Parts/Processors/Planetary3/base

Here is another example: [LOG 13:05:11.005] ActiveTextureManagement: is normalmap: False [LOG 13:05:11.006] ActiveTextureManagement: originalWidth: 1024 [LOG 13:05:11.006] ActiveTextureManagement: originalHeight: 256 [LOG 13:05:11.007] ActiveTextureManagement: originalFormat: DXT5 [LOG 13:05:11.007] ActiveTextureManagement: originalMipmaps: False [LOG 13:05:11.008] ActiveTextureManagement: width: 1024 [LOG 13:05:11.008] ActiveTextureManagement: height: 256 [LOG 13:05:11.009] ActiveTextureManagement: format: DXT5 [LOG 13:05:11.009] ActiveTextureManagement: mipmaps: False [LOG 13:05:11.010] ActiveTextureManagement: readable: True [LOG 13:05:11.010] ActiveTextureManagement: Saved 0B [LOG 13:05:11.011] ActiveTextureManagement: Accumulated Saved 51757343B [LOG 13:05:11.064] Load(Texture): CactEye/Parts/tele_bay/model002

And a third: [LOG 13:05:12.650] ActiveTextureManagement: Texture: CommunityResourcePack/Karbonite/Gilly_Karbonite [LOG 13:05:12.651] ActiveTextureManagement: is normalmap: False [LOG 13:05:12.651] ActiveTextureManagement: originalWidth: 640 [LOG 13:05:12.652] ActiveTextureManagement: originalHeight: 480 [LOG 13:05:12.652] ActiveTextureManagement: originalFormat: DXT5 [LOG 13:05:12.653] ActiveTextureManagement: originalMipmaps: False [LOG 13:05:12.654] ActiveTextureManagement: width: 640 [LOG 13:05:12.654] ActiveTextureManagement: height: 480 [LOG 13:05:12.655] ActiveTextureManagement: format: DXT5 [LOG 13:05:12.655] ActiveTextureManagement: mipmaps: False [LOG 13:05:12.656] ActiveTextureManagement: readable: True [LOG 13:05:12.656] ActiveTextureManagement: Saved 0B [LOG 13:05:12.656] ActiveTextureManagement: Accumulated Saved 51757343B

And finally (one with 1024 x 1024) [LOG 13:05:19.722] Load(Texture): Engineer/EngineerChipFlight/textures/EngineerChipHighRes [LOG 13:05:19.724] ActiveTextureManagement: Texture: Engineer/EngineerChip/textures/EngineerChipHighRes [LOG 13:05:19.725] ActiveTextureManagement: is normalmap: False [LOG 13:05:19.725] ActiveTextureManagement: originalWidth: 1024 [LOG 13:05:19.726] ActiveTextureManagement: originalHeight: 1024 [LOG 13:05:19.726] ActiveTextureManagement: originalFormat: DXT5 [LOG 13:05:19.727] ActiveTextureManagement: originalMipmaps: False [LOG 13:05:19.728] ActiveTextureManagement: width: 1024 [LOG 13:05:19.728] ActiveTextureManagement: height: 1024 [LOG 13:05:19.729] ActiveTextureManagement: format: DXT5 [LOG 13:05:19.729] ActiveTextureManagement: mipmaps: False [LOG 13:05:19.730] ActiveTextureManagement: readable: True [LOG 13:05:19.730] ActiveTextureManagement: Saved 0B [LOG 13:05:19.731] ActiveTextureManagement: Accumulated Saved 65055454B

I've noticed a difference between .24 and .25 when it comes to loading textures. In .25's case, I see the above log entries whether or not the cache has to be rebuilt. For .24, if the cache needs to be rebuilt, I see examples like this:

[LOG 13:56:57.308] ActiveTextureManagement: Rebuilding Cache... B9_Aerospace/Parts/Adapter_M1/model000

[LOG 13:56:57.308] ActiveTextureManagement: Saving cache file C:/Kerbal Space Program - Copy/KSP_Data/../GameData/ActiveTextureManagement/textureCache/B9_Aerospace/Parts/Adapter_M1/model000.pngcache

[LOG 13:56:57.319] ActiveTextureManagement: Created Config forC:/Kerbal Space Program - Copy/KSP_Data/../GameData/B9_Aerospace/Parts/Adapter_M1/model000.tga

[LOG 13:56:57.330] ActiveTextureManagement: md5: CD-7D-49-ED-EA-D4-9A-E9-2B-C3-04-68-3A-82-A0-5A

[LOG 13:56:57.331] ActiveTextureManagement: orig_format: .tga

[LOG 13:56:57.331] ActiveTextureManagement: orig_width: 512

[LOG 13:56:57.332] ActiveTextureManagement: orig_height: 512

[LOG 13:56:57.332] ActiveTextureManagement: is_normal: False

[LOG 13:56:57.333] ActiveTextureManagement: width: 256

[LOG 13:56:57.333] ActiveTextureManagement: height: 256

[LOG 13:56:57.336] ActiveTextureManagement: Saved Config.

[LOG 13:56:57.341] ActiveTextureManagement: Loading texture...

[LOG 13:56:57.381] ActiveTextureManagement: Texture loaded.

Also from .24, if the textureCache has already been built, I see stuff like this:

[LOG 13:47:34.224] ActiveTextureManagement: Loading texture...

[LOG 13:47:34.260] ActiveTextureManagement: Texture loaded.

[LOG 13:47:34.317] ActiveTextureManagement: Loading texture...

[LOG 13:47:34.320] ActiveTextureManagement: Texture loaded.

[LOG 13:47:34.321] ActiveTextureManagement: Loading texture...

[LOG 13:47:34.323] ActiveTextureManagement: Texture loaded.

[LOG 13:47:34.341] ActiveTextureManagement: Loading from cache... B9_Aerospace/Parts/Adapter_M1/model000

[LOG 13:47:34.360] ActiveTextureManagement: Loading from cache... B9_Aerospace/Parts/Adapter_M2/model000

[LOG 13:47:34.524] ActiveTextureManagement: Loading from cache... B9_Aerospace/Parts/Adapter_M3/model000

[LOG 13:47:34.568] ActiveTextureManagement: Loading from cache... B9_Aerospace/Parts/Adapter_Y1/model000

[LOG 13:47:34.801] ActiveTextureManagement: Loading from cache... B9_Aerospace/Parts/Utility_Light_N/model000

[LOG 13:47:34.811] ActiveTextureManagement: Loading from cache... B9_Aerospace/Parts/Utility_Light_N/model001

[LOG 13:47:34.825] ActiveTextureManagement: Loading from cache... BoulderCo/CityLights/Textures/detail

[LOG 13:47:34.846] ActiveTextureManagement: Loading from cache... BoulderCo/CityLights/Textures/main

[LOG 13:47:34.888] ActiveTextureManagement: Loading texture...

[LOG 13:47:34.941] ActiveTextureManagement: Texture loaded.

I hope this helps, ATM is a great mod.

Edited by Angel-125
Link to comment
Share on other sites

These are some of the problems with ATM and .25:

1. Scenery:* Tweaked the main terrain shader to use worldspace triplanar mapping on near detail textures. This means we now have enough texture accuracy to texture small rocks or even blades of grass. This is still an ongoing project though, not all Celestial Bodies use this new shader yet. (New shader means more memory)

2. Administration Facility (Meaning yet another new set of textures)

3. New Explosion Particle and Sound FX (more memory, mostly VRAM I would assume)

4. Destructible Facilties at KSC (More textures to load)

Now while this is no where near ATM's fault or the "direct" cause of not working properly, It is why the game is using more memory than 24.2. There are other thing's most likely, but these are the ones that popped out at me in the change log. I have been working all day trying to reverse engineer ATM and get it working but no luck and with mods with or with out ATM my game is very unstable i.e, sometimes it loads sometimes it don't and sometimes it is missing buttons and so forth with no rhyme or reason so far, but last night with the same mods I got now I was able to play fine for 5 hours so who knows. I am not one to just sit and wait but If that's what it takes so be it, I still have 24.2 to play until TACLS and this are updated LOL, just my two cents and my observations

Link to comment
Share on other sites

Maybe I'm talking out of my .. uh hat, yeah that's it. But wouldn't #1 and #3 be a function of your video cards and it's memory?

yes, that is true, but fact is, as we all know, KSP is not very memory effective at this time, hence why we have ATM. with out mods, .25 vs 24.2, .25 use's more ram and slightly more vram on my machine. everything seems to run through the RAM first and then is buffered by the VRAM if need be. In truth, a game like this should use less ram and more CPU and VPU/VRAM. In my experience, when a mod like this breaks due to new version, the first thing to do is identify the changes that would affect the mod, then work your way down. The modder who made the mod would know better than any one.

Link to comment
Share on other sites

Angel, well done with the sleuthing there! hopefully that gives the dev something to go on. As for me, my mod list looked basically the same as 'whaaw's up there. A ton of mods required ATM Aggressive. I took the plunge with 0.25 today and decided to vastly cut down my mods (1 reason was because they're not all .25 compatible, the other reason being that so many mods causes crashes eventually) I cut it down to 28 folders (including squad and nasa) and was crashing the game just after the loading bar but before the main screen. I tried with ATM basic and 'aggressive' that made no difference. I changed a couple of things in the ATM config and got it to load, but then the game crashed at the flight scene (using way over 3GB of RAM) I finally decided to try out the OpenGL mode without ATM....game's running fine now at 1.7GB (!!!) not sure how the performance will be with OpenGL but we'll see. (i5 3.4Ghz, 8gb RAM, 660Ti)

Link to comment
Share on other sites

With opengl and ATM working I save over a gig of ram I take a FPS hit but its not to bad better than running out of memory all the time. So the question that begs to be asked if you can make significant memory savings using opengl over the memory pig dx9c why stay on dx9c even the latter versions of DX are better on memory or bite the bullet and go full opengl

Link to comment
Share on other sites

after much digging and research it boils down to the ATM's dll plugin needs to be recompiled for the .25 code. all the cfg files in theory should be fine and work just fine, but since this whole mod depends on it's own dll until that is recompiled this mod will not work. If you noticed most mods that use their own dll plugins or depend on modder made dll's only needed the dll recompiled for .25 and no other changes it is only rational to assume that is the issue with this mod as well. At this time I can only run half the mods with .25 with out ATM as I could on .24.2. I am sure all will be well with ATM by the weekend. Ofcourse this is just a working theory of mine, I could just be to darn tired and be blowing smoke lol plus aside from this, I have been working on my mod for another game that has been in the works for 2 years now and also my own indie game too so who knows maybe I finally cracked :confused:

Link to comment
Share on other sites

ejwth9953: unfortuntately, the problem is deeper than just a simple recompile. One of the first things I did after noticing problems was to recompile ATM against the .25 dll. Angel-125 tried it too as he mentioned in his post. But I agree, I'm sure all will be well with it soon!

Link to comment
Share on other sites

New shaders means a few more kB of RAM. Maybe more in VRAM, but I doubt it.

I ran some test with an empty GameData. 0.25 uses 200MB more than 0.24.2. I ran a couple of other with a modified version of ATM but I made a stupid mistake and deleted them and I had too much to do with my mods to redo them right away. I'll try again tonight

My current opinion is that ATM works fine but that KSP loading use more memory somewhere while handling textures.

Virtualgenius : DX9 is the default mode for windows. Unity can run in DX11 too but your shader need to support it and it does not seem to be the case here. I did not look into it but I guess the GL mode use VRAM better, so your gains depends of how much memory your GFX card has. It's the same with DX11, but with ugly visual bugs :/

Link to comment
Share on other sites

I ran some test with an empty GameData. 0.25 uses 200MB more than 0.24.2. I ran a couple of other with a modified version of ATM but I made a stupid mistake and deleted them and I had too much to do with my mods to redo them right away. I'll try again tonight

My current opinion is that ATM works fine but that KSP loading use more memory somewhere while handling textures.

Thanx for all the work. Funny how every update one, mostly very very important Mod breaks... this time ATM gets the "couldnt imagine how i would miss it" price :)

Link to comment
Share on other sites

New shaders means a few more kB of RAM. Maybe more in VRAM, but I doubt it.

I ran some test with an empty GameData. 0.25 uses 200MB more than 0.24.2. I ran a couple of other with a modified version of ATM but I made a stupid mistake and deleted them and I had too much to do with my mods to redo them right away. I'll try again tonight

My current opinion is that ATM works fine but that KSP loading use more memory somewhere while handling textures.

Virtualgenius : DX9 is the default mode for windows. Unity can run in DX11 too but your shader need to support it and it does not seem to be the case here. I did not look into it but I guess the GL mode use VRAM better, so your gains depends of how much memory your GFX card has. It's the same with DX11, but with ugly visual bugs :/

you can get rid of those ugly visual bugs with this switch '-force-d3d11-no-singlethreaded' instead of just '-force-d3d11'

Link to comment
Share on other sites

New shaders means a few more kB of RAM. Maybe more in VRAM, but I doubt it.

I ran some test with an empty GameData. 0.25 uses 200MB more than 0.24.2. I ran a couple of other with a modified version of ATM but I made a stupid mistake and deleted them and I had too much to do with my mods to redo them right away. I'll try again tonight

My current opinion is that ATM works fine but that KSP loading use more memory somewhere while handling textures.

Virtualgenius : DX9 is the default mode for windows. Unity can run in DX11 too but your shader need to support it and it does not seem to be the case here. I did not look into it but I guess the GL mode use VRAM better, so your gains depends of how much memory your GFX card has. It's the same with DX11, but with ugly visual bugs :/

Thanks for that Sarbian I will be staying with opengl as it gives the bigger benifit

Link to comment
Share on other sites

Yep! Just discovered that myself. "-force-opengl" rocks for me too. Saved ~1.5GB in RAM leading to, hopefully, longer play session without the "around-3.5GB-boundary-crash-in-32-bit". As a side note, some texture were not showing properly with KSP 0.25 while they were okay on 0.24. They were also okay in Direct X mode for both version: Namely some from the ScanSAT mod and a few from the Karbonite mod. All were Targa files. I just loaded them in GIMP, converted them to PNG and the problem was gone.

I also noted that RAM usage on the GPU was way up in OpenGL mode compared to Direct X: now goes over 1.5GB versus roughly 700-800mb with Direct X. Can only be positive if you ask me...

On an Nvidia GPU, I noted that forcing anti aliasing mode in the control panel (32x CSAA + 8x SuperSample) seemed to actually make a difference on the visual quality compared to Direct X mode. GPU usage went up drastically as a result and consequence with such a high AA setting.

Finally, I had the impression that the general appearance of the visual was different in OpenGL. Shadows maybe or ambient occlusion... Darker lighted textures... Would need a side by side screenshot comparison to be sure.

This probably should not be posted on the ATM page but I was too existed to share my positive experience with others... hehe... :cool:

Link to comment
Share on other sites

while waiting for this to update does somebody know why my game crash if i run ksp with fullscreen opengl? (it work if windowed btw)

what I have noticed, check the crash log it makes. It seems too me on my .25 running with OpenGL is overloading VRAM and causing vidcard to crash. When I ran with dx9 I get crash do to lack of ram. Full screen takes more VRAM than windowed that is why windowed works and full screen don't. If you have 1 gig vram or less a crash from lack of vram is most likely the cause.

On a side note, I noticed today after installing all the same mods on both a 24.2 and .25 version of the game, on the 24.2 when game is loading ATM runs first and takes 3-5 mins before every thing else loads, on .25 I never see ATM in the loading bar,there for ATM must not be working as we all figured, this just goes towards confirming that. Also, running ATM on .25 may make your game crash more until it is fixed for .25 because it does build the texture cache and the game loads both the full size textures and the compressed ones, causing more crashes on my end any way, results may vary of course. I am running 24.2 until this is fixed because I can't live with out my mods and my system is too weak and/or game is to power hungry. I am on constant ATM forum watch until it is fixed, I just hope it is not going to be too big of a PITA to fix, I would feel awful for it's maker if it is. As far as any words to him, take your time, I think I speak for all this mods users when I say we are more than happy to wait for you in super chill mode :kiss:

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...