I am relatively new in HLSL, I am trying to implement blur for my new dynamic shadow material project. I can input Texture Object, but not TextureSample, and getting an error, Is there is any other function for TextureSample? If not how do I get alpha from Texture Object? I am totally confused.
Error with TextureSample: error X3004: undeclared identifier 'TexSampler’
Solved! We can separate alpha from the custom node, indeed we cannot use the component mask with texture object on account it taking texture reference rather than per pixel value. There are two ways we can separate alpha either by using an alpha variable to pass the information into it (it would require UE 4.26.0 or newer versions on account of new functionality introduced for additional outputs) or use a component mask later the custom node without declaring a variable for alpha. I would suggest using the component mask as the result isn’t more expensive rather than using a variable in the script.
I’ve been struggling with outputting alpha for texture blur for quite a while - I couldn’t have thought about simply changing the color input and output from float3 to float4 and masked it will solve the issue!