How do i get Alpha from Texture object that I have passed into custom blur function? Or is it possible to use TextureSample instead Object?

sayooj_js
Sat, 19 Jun 2021 11:57:30 +0000
Asset Creation

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’

With Texture Object

With TextureSample

Source:

float3 blur = Texture2DSample(Tex, TexSampler, UV);

for (int i = 0; i < r; i++)
{

blur += Texture2DSample(Tex, TexSampler, UV + float2(i * dist, 0));

blur += Texture2DSample(Tex, TexSampler, UV - float2(i * dist, 0));

}

for (int j = 0; j < r; j++)
{

blur += Texture2DSample(Tex, TexSampler, UV + float2(0, j * dist));

blur += Texture2DSample(Tex, TexSampler, UV - float2(0, j * dist));

}

blur /= 2*(2*r)+1;

return blur;

Source reference:

docs.unrealengine.com

Custom Expressions

Expressions that allow the use of custom, plain shader code.

4 posts - 3 participants