Written and directed by M. Night Shyamalan ; director of photography , Tak Fujimoto ; edited by Conrad Buff ; music by James Newton Howard ; production designer , Jeannine Oppewall ; produced by Mr. Shyamalan , Sam Mercer and Barry Mendel ; released by 20th Century Fox .