Sampling texture array in vertex shader?

Hi,

I know that I can sample textures in the vert shader with tex2Dlod, but I can’t seem to find a texture array equivalent. There seems to be a CG tex2DARRAYlod function, but I can’t seem to find a Unity-equivalent one.

Is sampling a texture array in the vert shader possible in Unity? Thanks!

I think you may need to use the shader model 5 texture sampling api, instead of the old style tex2d (etc) stuff. See SampleLevel (DirectX HLSL Texture Object) - Win32 apps | Microsoft Learn

We have the UNITY_SAMPLE_TEX2DARRAY_LOD macro to do this in a way that works on all compatible platforms.

1 Like