Moved mask and shadow render code.