Download

Is this a bug, or am I just missing something?

I can’t seem to figure out how to sample a texture in HLSL code via the material editor’s [FONT=Courier New]Custom node.
In the images below, I’m attempting to create a simple “pass-thru” shader, which simply returns the source colors.

W8r2RLo.png

Notice the VERY simple HLSL code here:
a96e3103895fe6878258ee644770f6f4260161d5.png

But for whatever reason, it spits out these errors:
5addebba6b2da260c15908bfc0df8c33a3d45545.png

Why!?
I’ve even tried several variations of the code, such as [FONT=Courier New]return tex2D( Tex, UV.xy ); but I always get the same error whenever I try to make use of the [FONT=Courier New]tex2D intrinsic function.
Am I missing something here, or is this a bug?

You wanna use something like Texture2DSample(Tex, TexSampler, UV); (Tex and UV would be the parameter inputs in the custom node).

Thanks, that seems to work, but requires Tex to be a TextureObject node.