I need to check NaN values in the fragment shader, but it seems that the HLSL intrinsic function isnan
is not working properly.
here is the part of the shader:
float ori;
float4 frag(v2f I) : SV_Target
{
float4 c = {0,0,0,0};
if (isnan(ori))
{
return c;
}
c = {1,1,1,1};
return c;
}
I get white color when ori
is set to 0, but when I set ori
to NaN, instead of full transparent, showing the background color, it always shows black color.
so , my question is that is the isnan
not supported in shaderlab, or I need to open some shader compiler flags, or else how to check this NaN value without the isnan
function.
I am testing the shader in unity 2019.3.0b8
Thanks.