I have got a fragment shader with the following lines of code …
if(v4Position_LightSpace.z <= 1.0 || v4Position_LightSpace.z >= -1.0)
color = texture(texture1, v2TextureCoordinates, 0);
else
{
v4Position_LightSpace is passed in by the vertex shader.
How come that an IF-Statement that can never be FALSE always ends up in the ELSE block ?
I am getting nuts with this !
krOoze
December 2, 2021, 5:25pm
2
It can be false if it is NaN. Or you improperly infer it ends up in the else block. E.g. being tricked by texturing in non-uniform control flow.
2 Likes
It was in deed NaN … thanks for the hint.
The “not a number” was caused by a view matrix with look_at-Vector pointing straight downwards and an up-Vector pointing straight upwards. After adjusting the up-Vector everything worked fine.
Thanks again
system
Closed
June 3, 2022, 10:08pm
4
This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.