first, sun light has a range of only 0....100 Let's assume that MoveSun is set I think the code works, but the sun is a dynamic light. so if you rotate the sun ingame, the rendered shadows on the blocks won't rotate with it. however, stencil and projected shadows will. This might be the problem.