material

MF_SobelSample

  • Exposure: public
  • UE Version: 4.25

avatar author

XavierPan

December 10, 2020, 12:29 pm

//HLSL Code:

float x = offset.x;

float y = offset.y;

float4 v1 =

float4(

Tex.SampleLevel(TexSampler, uv + float2(+x,+y),0).x,

Tex.SampleLevel(TexSampler, uv + float2(+x,-y),0).x,

Tex.SampleLevel(TexSampler, uv + float2(+x, 0),0).x,

Tex.SampleLevel(TexSampler, uv + float2( 0,+y),0).x

);

float4 v2 =

float4(

Tex.SampleLevel(TexSampler, uv + float2(-x,-y),0).x,

Tex.SampleLevel(TexSampler, uv + float2(-x,+y),0).x,

Tex.SampleLevel(TexSampler, uv + float2(-x, 0),0).x,

Tex.SampleLevel(TexSampler, uv + float2( 0,-y),0).x

);

float4 v = v1 - v2;

return (float2(v.y, -v.y) + 2.0 * float2( v.z, v.w) + v.x );

//Output Type :CMOT Float2

//Input 0: Tex

//Input 1: offset

//Input 2: uv

Click the button above, it will automatically copy blueprint in your clipboard. Then in Unreal Engine blueprint editor, paste it with ctrl + v