The first time Sylvain Chomet came to Scotland was in the summer of 2003. The Oscar-nominated French director arrived by train with his 11-year-old daughter during the Edinburgh Festival. He pulled into Waverley in the afternoon as the skies were blushing pink, the light was mellowing, and the east end of Princes Street was cast into shadow. He walked out of the station, and looked up.
"It's difficult to explain what happens when you fall in love with a city," Chomet tells me in a thick Parisian accent. "It's like when you meet a person and feel you have known them all your life.
"I remember a feeling of vertigo, because of all the layers and steepness of the city. But mostly it was the sky. It's always moving. You step off the train and feel as if the landscape is still rushing past because the skies are always changing. I fell in love with that. You can't find skies like this anywhere else."
Chomet realised that what would be a hindrance for other film-makers would be a boon for him. "This is why you can't do live action films in Scotland," he goes on. "It's impossible to shoot with all that changing light. But in animation it's not a problem. It's beautiful. So it was very obvious to me. I knew Scotland would be the place to set my next film."
• In pictures: Edinburgh comes to animated life in The Illusionist
The result is The Illusionist, the most expensive feature film to come out of this country and a love letter to Edinburgh and the islands that no VisitScotland budget could buy.
Based on a Jacques Tati script that languished in the French cinema legend's archives for 50 years, it cost 14 million, a huge budget for a European art house film, and has left behind more than 300,000 drawings, currently stored in Dundee.
It must be the only film to open the Edinburgh Film Festival that ends with a glorious sweeping shot over the Crags and the beating heart of the city, each trundling bus, criss-crossing New Town street, and higgledy-piggledy rooftop rendered with luminous detail, while above the shifting skies race past.
At the height of production the Edinburgh studio Chomet set up with his wife not long after that fateful train journey became the biggest 2D animation unit in the world. Not that we knew much about it.
It seems astonishing to think that 80 or so animators descended on Edinburgh from England, France, Spain, Denmark, Malaysia, Australia and more to spend years beavering away in studios on George Street and the Royal Mile.
Speaking to Chomet and meeting producer Bob Last in Dundee, I soon realise that the fact The Illusionist was made at all is a miracle. But we'll come to that. Everything about this film, from the way the script came to Chomet to its location and the magical end result five long years later, has a serendipitous feel. It's a story every bit as remarkable as the film.
Chomet came to the script through his first feature, Belleville Rendez-vous (Les Triplettes de Belleville). A surreal and beautifully hand-drawn animated film about an old woman with a club foot, her bulging-thighed cyclist son and a very fat dog, it broke the mould in a world crowded with computer-generated toys, fish called Nemo, and disappointing Disney sequels.
"In The Triplets there is a scene where they are watching television in bed and I thought it would be funny to have them watching a Tati film, Jour de fte," Chomet explains. His producer sent early drawings to Tati's estate, and his only surviving daughter, Sophie Tatischeff, immediately got in touch. She mentioned an unproduced script that her father never made that she wanted to gift to Chomet. She felt he understood Tati's sensibility and shared his vision.
"I was in Canada making The Triplets and she was in Paris," Chomet continues. "I arranged to meet her in Paris a few months later. But she died in the meantime. In the end I never met her, or even spoke to her."
The Illusionist is about a father-daughter relationship of sorts, a bond of kindness between two isolated people who meet in a pub on Iona. Suddenly, it becomes clear why Chomet's arrival in Edinburgh with his own daughter was so meaningful. He seems to see an overlap between Tati and himself, as though he is telling both their stories simultaneously in The Illusionist.
"The story is in some way about a father and daughter," he notes. "It was Tati's daughter who gave it to me. Tati wanted to make the film with his daughter but never did. And my daughter became a woman by the end of the production. When we started she was 11. Now she is 17. There were a lot of reasons to do this film in this place at this particular time in my life. When the illusionist arrives in Edinburgh by train, that was my experience exactly."
The script tells a sad, elegiac tale with almost no dialogue and scarce amounts of the silliness and slapstick that we associate with Tati and his clowning alter-ego, Monsieur Hulot. Instead, it's a pastel-hued, bittersweet fable about a doleful magician in an overcoat, based on Tati and called Tatischeff, accompanied by an enormous, aggressive blob of a white rabbit.
"I wasn't expecting much when I read it," admits Chomet. "I thought there would be a reason why Tati didn't do it. I had no idea it would be this jewel. I found it so moving. We discover Tati with this film. He is not just the clown. He is a serious guy, a lonely guy. In fact he was even more lonely in the script. I gave him a family back in France that Tati did not in his script."
The original script was simple and sweet and Chomet kept around 80 per cent of it. Set in 1959 when the music-hall tradition was dying out with a sigh, replaced by the early stirrings of rock 'n' roll, Tatischeff is forced to leave Paris and travel ever further in Europe to find audiences to entertain. But in the original script, his journey takes him to Prague, not Scotland.
"I didn't agree with the location," Chomet says. "I had been to Prague and it's a nice city but it doesn't have the magic of Edinburgh. And in part of the script Tatischeff travels to this village where they are celebrating the advent of electricity. But there wouldn't have been electricity there in 1959." When Chomet and his Edinburgh studio, Django Films, started researching 1950s Scotland they discovered that electricity arrived in Iona exactly in 1959.
"That was amazing," admits Chomet. "It's why it was crucial that we lived and worked in Scotland. It makes the film rich with detail and we could really do our research into the 1950s. We could send background people to Mull and Iona to study the light and the colour of the grass. We could look at the stations, the trains, and the buses. We could take photos on our walk to work."
As a result The Illusionist is packed with rich local colour and elegant period detail, from the interiors of Jenners (one scene takes place in a window display of the store) and the 1950s fashions, to the fish 'n' chips shop selling "deep fried chocolate bar" and, rather hilariously, "lobster thermidor topped with haggis and fried egg". There is a warmly drawn caricature of a drunken Scotsman in a kilt, a scene where Tatischeff watches a Tati film at the Cameo, and a session in the Barony Bar on Broughton Street.
In Iona, Tatischeff meets the young, naive islander Alice, who becomes convinced his magic tricks are more than illusion when he conjures up a pair of shoes for her. He takes her to Edinburgh, where he gets a job at the Empire Palace Theatre, now the Edinburgh Festival Theatre. "That's where the film is being premiered at the festival," says Last with a smile. "Of course we could never have known that at the time. It's another lovely, strange coincidence."
For Billyboy and the Britoons, the pastiche rock 'n' roll band muscling in on Tatischeff's audiences, Chomet approached Malcolm Ross. Guitarist in Orange Juice and Aztec Camera he wrote and performed three songs for The Illusionist. "I was thinking of early bands like Cliff Richard and the Shadows," says Chomet. "Malcolm did a great job. And I ended up writing the orchestral music myself."
For Chomet, though, the dream did occasionally tip over into nightmare. We first met four years ago in his George Street studio, where I watched animators do careful line drawings of Waverley and bring kilted characters to life on the page as they flipped through drawings. Chomet came across as rather proud, haughty, and rightfully convinced of his talent. He also seemed bitter.
At that stage another two people were arriving at the studio each month and the collective feeling was that within these four walls something incredible was happening. The problem was that no one in Scotland seemed to care much about it. At that stage Chomet, who had just been fired from directing The Tale of Despereaux because he didn't have enough financial support to keep it in the country, still wanted to continue making films in Scotland. But the studio was disbanded after The Illusionist wrapped and he and his wife now live in Provence. Django Films is no more.
"Nothing changed much," he tells me. "You know, 300 people worked on this film. In Scotland we had two studios in Edinburgh and one in Dundee. We worked with two studios in France and one in Korea. I really thought there would be a lot of great opportunities here. It wasn't anything to do with the will of the Scottish people. Everyone was warm and welcoming.
"It was that nobody took us very seriously when we set up the studio. We didn't have any help from the authorities. The schools were not interested. It was like I was disturbing their routine. I think a lot of these institutions are hiding behind incompetency. They don't want people to say they're doing anything wrong."
In Dundee, where Last set up his animation studio Ink.digital seven years ago, the producer agrees, well to some extent. "I do share Sylvain's bafflement," he says. "I would turn up at the studio in Edinburgh every day and think here we are, in Scotland, the biggest studio of its kind in the world. And no one knows it's happening." However, Last is pleased The Illusionist received no money from Scottish Screen or the Scottish Arts Council.
In fact, there was no Scottish funding at all and they didn't apply for it. "I think it's an entirely positive thing that none of the money came from Scottish coffers," he insists. "It's a sign of maturity that we're able to bring commercially funded global productions here. We don't have to go and knock on our exhausted taxpayer's door for money and I'm proud of that. And it meant that the translation of the script to Scotland was a purely creative decision. It had nothing to do with money."
Last takes me round Ink.digital, where during the production of The Illusionist the staff of 12 climbed to 40. He describes working on the film as a labour of love and the toughest creative experience of his life. The team is young and satisfyingly geeky. I meet one animator who was sent to Seoul, South Korea, for three days and came back three months later, such was the volume of work.
Most of the production here involved colouring in characters, digitising (the film has 3D as well as 2D elements), and what's known as inbetweening: making drawings between the lead animator's ones to ensure movement is as smooth as possible.
I'm shown a stack of sketches of Alice, 505 in total, that amount to just 20 seconds of film. For each second of The Illusionist, at least 24 drawings were made. All the characters were hand-drawn but some of the backgrounds, such as the sweeping aerial shot of Edinburgh, were computer-generated in order to achieve such rich levels of detail.
Both Chomet and Last were frustrated that well-established animation courses at Edinburgh College of Art and Duncan of Jordanstone in Dundee weren't more involved. But it's not an issue exclusive to Scotland. The global surge in popularity of CG animation has led to a decline in teaching traditional drawing skills the world over. "When Toy Story, the first CG feature was made people at Disney said hand-drawn animation was dead," says Chomet, shaking his head.
"Even in London, where I learnt to animate in the Eighties, it's completely gone. The only place in Britain I found where they were teaching it was in Bournemouth, so I hired seven people from there." Towards the end of production, they struggled to find people with the drawing talent necessary.
Today Chomet is in Paris where drawings from The Illusionist are being exhibited. During the Edinburgh Film Festival some of the stills will be shown in the windows of Jenners. Chomet is pleased about this but tells me he has been burnt by the whole experience and is not going to make another animated film for a while.
He doesn't want the pressure of running a studio and he fancies trying his hand at live action films. He seems just as opinionated ("if people in Scotland think the future of animation is in stupid videogames, well good for them"), uncompromising, and visionary as ever. Last concedes that Chomet is renowned for being demanding and "is not the easiest guy to work with", but points out that "the same could be said for many of the most interesting filmmakers".
This is certainly true. Chomet is a director striking out on his own. For Belleville Rendez-vous he holed himself up in Montreal for five years to make a strange and singular film with almost no dialogue, a cartoon that was for adults as well as children. Now, he has done it again in Edinburgh.
Like Tati, he is an artist with a unique vision, travelling to parts of the world where he can work in the way he needs to. In the end, like Tati and his illusionist, he disappears, leaving behind no trace but the art itself. "I want to get away from it," Chomet admits to me. "Leaving Scotland feels OK because we've left behind this film. The bitterness is not going to show when you see The Illusionist. I'm proud of it."
The Illusionist opens the Edinburgh Film Festival on Wednesday at the Edinburgh Festival Theatre, and is distributed by Pathe, www.edfilmfest.org.uk
• This article was first published in The Scotsman on Saturday, June 12, 2010