An avid reader of science fiction, Petri began work on an adaptation of Sheckley's story in 1961; producer Carlo Ponti came onboard the project due to the involvement of Mastroianni. A variety of screenwriters worked on the script to varying degrees without receiving an onscreen credit, including Suso Cecchi D'Amico, Nate Monaster and Ernesto Gastaldi. Ponti's lack of interest in the science fiction genre led to his mandating of more comedic elements in the story against Petri's wishes, including altering its original, pessimistic ending. Backed by financial support from Joseph E. Levine's Embassy Pictures, filming took place primarily on location in Rome and New York City from June to September 1964; produced at the height of the pop art movement in Italy, Petri sought to create a vision of the future that juxtaposes that style's imagery with Rome's ancient and modern architectural structures, such as the Colosseum and the EUR district.