I’ve seen a few posts that touch this subject, but none of them really give a definitive answer. I’m working on a 3D game, and some of the textures get quite big (2048x2048 or 4096x4096), which quickly starts eating up VRAM. This is fine for higher end devices, but I want the game to be as optimized as possible. Most games nowadays solve this by implementing a texture quality setting which limits the amount of mipmaps loaded. I’m wondering if there is any way to do this in Godot currently? Some people mention increasing the mipmap bias but that does NOT decrease VRAM usage, because all the higher res mipmaps are still loaded in memory. I’m wondering if there’s any way to possibly limit the amount of mipmaps loaded on a texture, just how the size limit import setting does, except I would like to do it on all textures at runtime.
It’s not about picking a specific mipmap, but limiting them to not load the highest resolution ones. Engines like Unity and Unreal implement this via a texture quality setting.
What are “highest resolution ones”? You mean the actual textures? That what size limit is for. Mipmaps are always lower resolution versions of the actual texture.
I think you’re going to have to create multiple copies of the texture file and load the one with the desired quality. Mipmaps are always created from the full-resolution texture so you can’t load only the lower-quality ones
Yes, but the point isn’t to limit the texture quality as a whole, but instead doing it based on a setting in-game. Which other engines do implement.
For example, from Unity quality settings documentation:
Choose the maximum mipmap level that Unity uses when rendering textures. Higher mipmap levels have lower resolutions, which means that the textures require less GPU memory and less GPU processing time. The options are Full Res, Half Res, Quarter Res and Eighth Res. Textures that do not have mipmaps will render at their full resolution, regardless of the option you choose.
The problem with Godot is that there isn’t a global setting for it that can be adjusted, you can only do it on a per-texture basis via the import tab.
It seems like this is the most common solution, which I was hoping to avoid. As having to keep track of the same texture multiple times and reloading them isn’t ideal both in terms of development time, file sizes, convenience etc.
Afaik there’s currently no automatic way to do what Unity does. Judging from that description, the limiting happens when texture data is uploaded to gpu. I’m not aware of any way to customize that process in Godot. This would be nice to have, and it’s not too hard to implement, so maybe write a feature request.
You can set limit for all imported textures using import defaults though. So if you want to swap all textures, change that default and delete all imports. It should trigger the reimport with the new limit. It’s strictly editor of course, so sizes will still be “hardcoded” per export.
Quite unfortunate that even with the mass amount of 3D improvements in recent versions no form of texture streaming has been implemented so far. It’s such a massive help in terms of optimization. Oh well, hopefully it can be figured out soon enough.