HLSL code 'Texture2D' to 'sampler2D'

I did some research and found a working method. Tested in Unreal 5.4.4, should work for SM6 I guess

The syntax is Texture2DSample([TexObject], [TextObject]Sampler, [UV]);
If you have an TextureObject named “AA”, the automatically created sampler would be named “AASampler”.

return Texture2DSample(InTex, InTexSampler, float2(0.f, 0.f));
2 Likes