Post

"Interesting" new bug with OpenGL and GLSL : I have a piece of code that determines the shadow cascade to use from a world position. I found something weird so made a minimal example. Here are the two results if I use a loop or if I unroll the loop:

0 reposts2 likes

Any reason for writing 3-1 instead of 2? What happens if cascadeIndex is greater than 2? If you ever find out why it behaves like that, I'm curious :D

It's just something I forgot to replace when I wrote an example, even if I replace 3-1 by 2 it does the same. If cascadeIndex is > 2, the color is pink but it never happened.

The whole code basically just takes the world position and multiplies it with the view matrix to get the view position, calculates the cascade index, and, if the cascade index is 0, it's red, if it's 1, it's green and if it's 2, it's blue. The unroll version is the correct one.