Not a whole lot to talk about this month, since I didn’t really work much on side projects. The one thing I’d like to discuss is something called “texture arrays”.
In a nutshell, a texture array is a bundle of multiple textures that are treated as a single unit by the graphics card. Now, you wouldn’t simply want a massive texture array with every texture in the scene, because then it would take up a massive amount of memory, including memory for textures for objects out of view that you don’t currently need.
However, in situations where the multiple textures are always going to appear together (eg. multiple textures on a single character,) using a texture array is better than just multiple textures because each separate texture comes with some rendering overhead (in particular, separate draw calls for each material.)
The idea here is similar to texture atlases, where multiple images are combined into a larger image. Texture atlases also have the benefit of fewer draw calls, which is why they are commonly used. However they also have a number of downsides, mostly relating to the fact that each “texture” is really just a subsection of a larger image. For starters, you can’t ever have texture coordinates go outside the image. That means you can’t tile an atlased texture across a surface.
Another downside of texture atlases (and one more relevant to a project I have in mind) is that you can’t do visual tricks like world-space texture coordinates. Since the UVs are carefully used to target sections of a texture atlas, any generating or manipulation of texture coordinates is going to screw that up. Texture arrays however allow you to get the benefit of combining multiple textures into a single unit and also do stuff like world-space texture coordinates and tri-planar mapping.
So this post gives a good overview of what texture arrays are and why you’d use them. Meanwhile here’s a bunch of resources to learn how to use them. During my research, I found this article to be especially informative.
The main gotcha I’m seeing is that support for texture arrays is somewhat hit-or-miss. Perhaps I’m being overly worried and it’s actually supported wider than I fear, but the articles I’m reading indicate that texture arrays will only work on the latest graphics cards.
Do texture arrays work on mobile? I’m gonna have to do some more research…