Hello, I recently followed Temaran’s tutorial (GitHub - Temaran/UE4ShaderPluginDemo: A tutorial project that shows how to implement HLSL Pixel and Co) for Shader in UE4. Actually I try to pass a UTexture2D (I don’t create this texture during Runtime) to Shader then I convert in FRHITexture via UTexture2D->Resource->TextureRHI.
Here is my Pixel shader :
Texture2D texturesample;
SamplerState mySampler;
float4 myColor;
float4 mainPS(in float2 UV: TEXCOORD0) : SV_TARGET0
{
float4 packedValue = texturesample.Sample(mySampler, UV);
if(packedValue.x > 0.0)
return float4(1,0,0,0);
return myColor;
}
Shader’s parameters are similar with tamaran I just added FRHISamplerState.
My Project crash if I click on Play. This error seems to be caused by if(packedValue.x > 0.0) .
Is it caused by conversion between UTexture2D to FRHITexture ?