Oni @oni.team-nutshell.dev · Jun 22

"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:

2 likes 2 replies

?

Replies

Bycob · Jun 22

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

Oni · Jun 22

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.