- Home /
Reduce GPU Memory usage from textures
i have a huge scene with a lot of high detailed textures. As a result the scene currently needs about 2GB GPU Memory. Since i can't expect everyone to have so much GPU Memory, is there a way to reduce the memory usage?
A few ideas i have already tried:
Only a small part of the scene is visible at any time. Splitting it in smaller scenes should therefore be a possibility, but when loading the additional scenes in the background, i get framedrops or the game is frozen for a few moments. Besides that, i can't be sure a part of the scene is loaded in time.
Using AssetBundles had similar issues, besides additional code.
I have nearly no RAM usage, is there a way to move unused textures temporarly to it?
The textures are compressed and mipmaps are turned off.
Different Quality-Settings didn't change anything notable.
Sidenote: CPU, GPU and RAM usage are no issue.
edit:
A bit background information, in case this helps: I'm creating a 2D-RPG with HD graphics and big levels. Think of it a bit like older Final Fantasy or Pokemon Games, but i'm not using tiles, instead a more natural/artwork-like style. Therefore the textures are bigger and require more space. The level-size is usually somewhere between 20000x20000 and 60000x60000px, on multiple layers and split on multiple parts (to bypass the 2048x2048px texture limit on some devices). Huge sizes of assets-files are expected, but i'm searching for a way to reduce the size in the GPU memory.
Can you provide more information like what device setup you have and which texture compression you are using?
And try checking memory profiler for info on textures. A wrong setup with asset bundles can blow up memory usage without noticing.
Furthermore, are your textures all set to some kind of ultra size?
Last, are you packing the textures correctly?
The game is developed for PC/$$anonymous$$ac. Textures are DXT5 and BC7 compressed. (depends on the texture) Different compression-quality-levels have been tested without much difference. I'm not using crunch compression.
The texture size it self isn't an issue, but that all textures of a scene are loaded at the same time.
Background-infos in case it helps, were added to the question.
Well, if its something you wish to do, then you need to split images a bit more.
Old classic 2d scroll games similar to Super $$anonymous$$ario, used extra buffer area where tiles were prepared and kept hidden unless the user goes to that region.
I have no idea how large your world map is, but I'm sure you can divide them into at least a few groups, and in the background, async load resources for linked maps.
Some games do struggle to keep up with user's actions, moving too fast, poor read times and etc.
You can:
- reduce texture size
- pack textures into atlases - use same textures more often
Other than that your really can only load level peaced one after another. With a good strea$$anonymous$$g system, that's possible. LoadLevelAsync is your friend
Or, if you're having frame problems as you mentioned, change the level design a bit. Add more doors or pathways that lead to a new scene
Frame issues appear only at the point were a new scene is set active/asset bundle is added to scene (usually a frame-drop a small freeze) after that everything runs as normal. Probably since a lot of textures are loaded in the GPU memory.
Reducing the texture size is always a possibility, but then the game looks blurry on high-resolution-screens. Therefore this is only the last option.
Reusing textures isn't possible, since levels are based on an artwork. (See additional info added to the question at the bottom)
LoadLevelAsync was already considered but i got framedrops/the game is frozen for few moments at points were the sublevels are loaded and set active. (See question)
Answer by henry_jvx · Jun 14, 2017 at 07:35 AM
i think there is nothing to do, because the engine is well optimized to save memory usage by default (ram and g-ram) .
i think you are working with too exessive texture sizes even if you want to show a single texture in the whole screen. most of HD games uses 2048 x 2048px textures max, even HD4k games. besides. dissabling mipmaps with 6kpx textures may overload the gpu and throw down the framerate, so your players will need a powerfull graphic card anyway.