+2 votes

I use 2048*2048 textures for 3D objects. I would like to implement a texture resolution switch (512/1024/2048) in the game settings. How can this be done in Godot?

in Engine by (355 points)

2 Answers

+2 votes

I'm afraid you will have to swap all textures of all 3D objects with a manual script, I'm not aware of any easy engine switch to change which textures get loaded at runtime for now.

It may be just a script running on every instanced scene which replaces materials or textures in those materials by their lower res counterpart. The problem is, that won't prevent the initial high-res texture from loading first.

You may want to ask for this in the issue tracker (i.e a "quality setting" option to make the engine switch between materials). But doing so will often involve scripting on your end regardless.

by (28,744 points)
+2 votes

If you are still fine with loading the large textures, and only want the smaller ones for performance then there is a way.

In the import settings, turn on Mipmaps. Then use the size limit to define what texture you want.
So you will import a 2048 texture, turn on mipmaps fot it and limit it to a 512 size. This is the same as using the shader LOD system.
The 2048 is still loaded but a smaller version is rendered.

by (1,451 points)

No, that's not the right thing. I want to enable the end user of the game to be able to customize this. All this for the sake of achieving sufficient performance on weak PCs. It makes no sense to load a large one - display a small one.

That is how most AAA games do things. First the texture is loaded into ram, a mip is selected and passed into the graphics memory.
On PC RAM is considered cheap, it is the one thing any gaming PC has in abundance.

One trick you could try, is making new textures from existing one at real-time. That way it loads the large texture, makes a small one and removes the large one from memory.

One trick you could try, is making new textures from existing one at real-time. That way it loads the large texture, makes a small one and removes the large one from memory.

Yeah, it's probably the only thing I can do right now. But this is very inconvenient both in implementation and in future changes. I was just asking if there was any automated solution.

I opened the offer: https://github.com/godotengine/godot/issues/23739

While the project I'll leave it as is.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.