TextureArrays in Shader look white when looked from too far.

Hi.
I’m currently working with Texture Arrays and Shader Graphs for a full DOTS/ECS project.

I was able to create some Animations by using Texture Arrays (instead of Spritesheets) and by creating a specific ShaderGraph that will print the texture at the given index.

Here’s how the shadergraph looks:

It basically takes a TextureArray and Certain texture index as input parameters.
It will then use the index to display the texture at the given index.
So far it works fine, but I’m having the following problem:

6743587--777349--texture_array_white.gif
If you notice there’s another texture by the character’s side but that doesn’t seem to be affected by the distance (or size in this case).

Here are the settings I’m using for the shader graph:
6743587--777352--upload_2021-1-19_23-34-21.png

I have no idea what the problem is.
Not sure if it’s related to ECS (and Hybrid Renderer V2) still being on Preview, or if I’m messing up something with the shader.

Anyways, I was hoping anyone could shed some light on what I might be facing.

Thanks in advance and let me know if you would like to know more info on my current setup.

Regards.

This looks like an issue with the mipmaps on your texture array so it probably has more to do with how you are generating your texture array than with your shader graph.

Double check you are updating mipmaps when you Apply() the texture data, or, if you are copying all the mipmaps over from a sprite, make sure it has generated mipmaps. Sprites are typically used at a specific pixel-perfect size so mipmaps default to off for them.

1 Like

Omg, thank you very much!
I just had to change my code to copy the textures using 0mip, and then recalculating the entire array at the very end, by using array.Apply(true);

Thanks a lot! You’re a life saver I’ve been struggling with that for a long time now.