<Tr> <Th> Budget </Th> <Td> $160 million </Td> </Tr> <Tr> <Th> Box office </Th> <Td> $799 million </Td> </Tr> <P> Shrek the Third is a 2007 American computer - animated fantasy comedy film and the third installment in the Shrek franchise, produced by DreamWorks Animation . It is the sequel to 2004's Shrek 2, and is the first in the series to be distributed by Paramount Pictures, which acquired DreamWorks Pictures, the former parent of DreamWorks Animation, in 2006 . Chris Miller and Raman Hui directed and co-directed the film, respectively, with the former also co-writing the screenplay with Jeffrey Price, Peter S. Seaman, and Aron Warner . In addition to Mike Myers, Eddie Murphy, Cameron Diaz, Antonio Banderas, Rupert Everett, Julie Andrews, and John Cleese, who reprise their roles from Shrek 2, the film also features Justin Timberlake in the role of Arthur Pendragon and Eric Idle as Merlin . Harry Gregson - Williams composed the original music for the film . The story takes place eight months after the marriage of Shrek and Fiona in the first film . Reluctantly reigning over the kingdom of Far, Far Away, Shrek sets out to find the next heir to the throne--Fiona's cousin Artie, while Prince Charming is plotting to overthrow Shrek and become king . </P> <P> The film premiered on May 6, 2007, at the Mann Village Theatre, Westwood in Los Angeles, and was released in the United States on May 18, 2007, exactly six years after the first film was released . The film grossed $799 million on a $160 million budget, becoming the fourth - highest - grossing film of 2007 . It was nominated for Best Animated Movie at the 2008 Kids' Choice Awards, but lost to Ratatouille . It was also nominated for the BAFTA Award for Best Animated Film at the 61st British Academy Film Awards . It was the final film in the Shrek franchise to be produced by Pacific Data Images, before its closure in 2015 . It was followed by Shrek Forever After in 2010 . </P>

Who does justin timberlake play in shrek 3