refactoring for shadow map