Page 1 of 1

Texture Array Performance

PostPosted: Mon Aug 27, 2018 8:59 pm
by Nijiem Arih
Hi,

I'm building a large open world game that uses a large amount of texture assets (both adhoc/unique and tiling). I've been looking at utilizing Texture Arrays as part of an optimization pass and am considering moving every texture asset into an array.

Is this a naive approach? Is there any performance issues that can be foreseen, such as issues regarding potential large numbers of Texture Arrays?

Even more generally are there any draw backs to using Texture Arrays as opposed to a traditional Texture Atlas?

Also, wanted to ask if there's a way to "append" textures to the end of a texture array so that the textures currently in the array maintain their position — I'm thinking about long term maintenance on a texture array and wanting to avoid breaking references that materials have to preexisting indexes.

Thanks for the help and advice!

Re: Texture Array Performance

PostPosted: Tue Aug 28, 2018 11:25 am
by Amplify_Borba
Hello, thank you for getting in touch and for your support!

Texture Arrays and Texture Atlas are great for optimization, although you must also consider that the shader's performance will also depend on your implementation, on the target platform and on hardware as well.

There's almost no limit to how many textures you can use with them, the only limiting factor being that all the texture import settings between the the textures that compose a Texture Array must be the same, which is not the case for Texture Atlas.

Another difference is that for array textures, each texture is treated separately, avoiding common problems with atlases where you would need to add padding to prevent edge bleeding.

A possible reason you'd use Texture Atlas instead of an Array would be, for example, in case you'd have to pack together textures with different resolutions, as atlases grant you that sort of flexibility.

On a related note, we have a simple tool to allow you to create your own texture arrays, which you can find it at Window > Amplify Shader Editor > Texture Array Creator.

Image

Regarding appending textures at the end of the array, we don't really have a way to increment the array in such manner as this is something that depends on the tool used to create it, so you'd have to either use an alternate tool ( e.g. https://assetstore.unity.com/packages/t ... tor-109547 ) or manually add all the textures in the desired order.

It has been suggested that we implement something along these lines in our tool but, unfortunately, it's not something that we can tackle at this time.

Please let me know if this helps, thanks!

Re: Texture Array Performance

PostPosted: Tue Aug 28, 2018 3:30 pm
by Nijiem Arih
Thanks for the help, Borba!

I had another tangentially related questions: I'm also attempting to set up a shader that uses a texture atlas, but I want to be able to tile a specific section of said atlas.

An example I've come across is this node setup in Shader Forge: Image

Currently I'm using the Flipbook node with Time 0 to select the atlas index, but I'm running into some hitches attempting to get tiling to work.

Do you have any insight to offer here?

Re: Texture Array Performance

PostPosted: Tue Aug 28, 2018 3:40 pm
by Amplify_Borba
No problem, happy to help!

I've recently suggested the use of the Flipbook node for a similar situation in another forum post, as it seemed to work well in the tests I've performed.

Could you share additional details regarding the hitches you've come up with, or even your shader? Thanks!