Principal photography for Detective Dee began in May 2009; the film was shot at Hengdian World Studios in Zhejiang, China.
[4][5] It was followed by two prequels, Rise of the Sea Dragon (2013) and The Four Heavenly Kings (2018), also directed by Tsui and starring Carina Lau, and with Mark Chao as a young Detective Di.
She has a Guan Yin figure built overlooking her palace in Luoyang, but an official inspecting the progress mysteriously erupts into flames.
Penal officer Pei Donglai and his superior investigate and interrogate the supervising builder, Shatuo, who was formerly imprisoned after he took part in a rebellion.
The Empress orders former detective and rebel Di Renjie be released from prison after the Imperial Abbot states that he must solve the mystery of the fire.
Di speculates that the Empress used the Imperial Abbot to justify her tyranny and eliminate her political opponents, possibly including the late Emperor.
Refusing Wu's offer of a place in her court, Di resigns as inspector and retreats into the Phantom Bazaar with Dr. Wang, where he will struggle to live on with his incurable condition.
The screenplay was written by Chang Chia-lu,[14] the Taiwanese screenwriter of the films Forever Enthralled and A World Without Thieves.
Tsui never divulged most of the changes that he made to the original script, but did mention that the character Shangguan Jing'er was previously a man.
Prior to filming Detective Dee, Tsui had spent years doing research on stories concerning real life Tang dynasty official Di Renjie.
Li mentioned while promoting Tsui's other film, Flying Swords of Dragon Gate, that he had a chance to read the script though he wasn't able to be part of the project due to some unknown reason.
Sammo Hung served as an action director for the film and his stunt team built eight platforms (12 meters tall) in the cave for three days of wire work.
[12] One of the sculptures was an 80-metre bust of Empress Wu Zetian, a key element of the film that cost $12 million HKD to design and decorate.
[23] Detective Dee's martial arts sequences were choreographed by Sammo Hung, who worked extensively alongside actors Andy Lau and Li Bingbing.
Of the fight sequences for the film, Tsui commented that they are similar to that of Ip Man, as they aimed for realism with actual punches and kicks.