Per-Platform Max Texture Size - Is anybody already doing this before I do it?

I’m looking at updating our version of the Engine to add some options to the Texture Editor, so that I can specify a Texture size for each texture asset individually for different Platforms.

We’re in a situation right now where we have two branches in Perforce that we constantly have to integrate and merge into each other, but the only difference is that the Android branch has smaller textures, while the PC branch has the full-size ones. Pre-processor commands take care of everything on the code-side of things, so it’s purely from an Art perspective that we need the second branch. Obviously this is incredibly inefficient and it would be much better to make the Engine change. I don’t want to spend hours looking into this though if someone can save me the time.

Although the engine does have some config / INI options for this, they have no effect on the Build Process, and are global settings - meaning you can’t change the texture size per-asset. The only difference the INI makes is the size of the in-game textures, but if you’re not using Mip-Maps (like us), there’s no lower-res object to use. We also end up with a 6/7 GB package for Android, which obviously isn’t going to work.

I’m willing to spend the time getting it into engine and also submitting a Pull request once it’s in, since I think this is something everybody should have. I don’t want to waste valuable time on it though if somebody else is doing this already. I’d also like to fix the ‘Max Texture Size’ setting that already exists to work in both X and Y, because it currently doesn’t work for non-square textures even if they’re power-of-two.

This is what I have in mind, so before I start looking into this - does anybody know if this is possible because of the way UE builds packages, and more importantly, does anybody know where to start looking? Cheers!


I would imagine someone will confirm that setting Max Texture Size to use both X & Y values is not going to work, Square textures are more memory efficient as they tile easier. Given a texture that is wider than it is longer or vise versa and not square the engine will have more of a harder time with it than a square texture of the same resolution. This is why in game dev we use figures of 128x128, 256,256, 512x512, 1024x1024, 2k, 4k, etc. :slight_smile:

4k is a ridiculously large texture if you plan to run on Android. Some android devices cannot even render larger than 2k resolution. Perhaps you should reconsider the texture scales and assets in your project. Or port the project to a new uproject, get stripping for an android compatible version.

Well this is the point, I don’t want 4K Textures on Android, I want them to be scaled down to 256 or 512, without having to setup a second branch or re-scale hundreds of textures everytime I want to export to Tablet. (Which is what we currently do). We have the second project already, but I want to avoid that and use the same project, and the packing process will be smarter and scale down the textures during the packaging process - based on these settings.

The texture size issue is nothing to do with asset creation issues, in some cases we require textures that are still power-of-two, but rectangular instead (for example, 1024 * 512). This is a very common thing to do, but the Max Texture Size option that exists right now doesn’t handle that, and can only work with square textures instead.

Also as I was writing this, our Tech Director looked at this today and says that the Engine Code allows textures to be made smaller at packaging time via an AndroidEngine config file, but it only works per texture ‘group’, not per-asset. That’ll probably cover me for now but I think this is worth looking at in more detail anyway.

This will obviously depend on your setup. But, if the only difference between the two projects are the textures, and you already have the smaller versions, simply switch out the texture folders between builds. You just have to update the textures in both folders when each texture is edited.

You could also use hard links to create two project directories, and create a bash/batch script that linked the correct files in between builds. If you would like me to expand upon this idea, I could, but essentially, you would be editing one set of files in both directories, but the textures would be duplicated. You would also need to have two sets of of the prebuilt UNREAL files, so you aren’t constantly rebuilding them.

If you are on Windows, will allow you to create a link for every file in a source directory, while creating new directories and subdirectories. It can do much more, and is free. I use it to move the default Unreal Vault folder on Windows.

There are similar scripts for OS X and Linux.

That’s fine if you’re working alone but in a team with source control it’s going to inevitably cause problems, as there’s lots of room for error and mistakes to be made.

Sorry to revive a very old post, but I have this exact issue. What did you need to change in the AndroidEngine file?