you have a little problem here with math: c = c with normalized x c = c with normalized y c = c with normalized z so you don't normalize the vector itself but each of the components. this results in a weird shape. just use vec_normalize(c.x, 1); here instead of the whole normalization code