Monday, December 1, 2014

[UE4 Quick Tip] Sampling Textures in Custom Nodes

With Unreal Engine 4.6 it's finally possible to sample a texture in a custom node without clumsy workarounds.

Given a texture object (Tex) and some coordinates (UV) this line of code will regularly sample a texture:

return Tex.Sample(TexSampler,UV);

Other sampling types like 'SampleGrad', 'SampleBias' or 'SampleLevel' should work just as fine.

1 comment:

  1. Hi, thank you very much for sharing this, I've been looking for this information, and this seems to be the only place that mentions it. A remark and a question though.
    Remark: I'm using 4.9.2 now, and it seems that TexSampler should be texSampler (lowercase t).
    Question: where did you find this information? I'm wondering what else if possible in custom nodes, but I can't seem to find a good overview. Thanks!