Image copyright Fredrik Divall/De Warrenne Pictures Image caption Cave rescue diver Erik Brown is playing himself

The dramatic Thai cave rescue unfolded like a film. It involved a desperate search, selfless volunteers, an audacious rescue, and 12 boys and one man determined to survive against the odds.

Several films of the rescue are being planned, but the first to finish filming is The Cave by Thai-Irish director Tom Waller, which involves several of the actual rescue divers.

The BBC has been given a sneak peek into the first official photos from the film set.

Image copyright Fredrik Divall/De Warrenne Pictures Image caption Writer-director Tom Waller says he was in a unique position to make The Cave

Waller says that he became inspired to make the film as he watched the Thai cave rescue progress on tenterhooks.

"Like everyone else on the planet, I was following the news with much anticipation," he told the BBC.

"I realised that as a Thai filmmaker, I was in a unique position to tell this story."

The Cave focuses on the "volunteer spirit of the rescuers, and the untold personal stories of those involved in the mission", and is "embedded in a Thai narrative", he says.

Image copyright Fredrik Divall/De Warrenne Pictures Image caption Cave divers Tan Xiaolong and Jim Warny (left and centre) are playing themselves

Waller, whose previous work includes the award-winning film The Last Executioner, says more than a dozen participants from the cave rescue agreed to take part and play themselves.

"Everyone was extremely enthusiastic about the story, and there was no acting required for these real rescuers," he said.

"It was like being back at Tham Luang all over again for most of them, reliving the events."

Rescue divers involved include Belgian Jim Warny, Canadian Erik Brown and Tan Xiaolong from China.

Others were involved as consultants to help ensure the authenticity of the film, Waller says.

Image copyright Fredrik Divall/De Warrenne Pictures Image caption Cave divers Tan Xiaolong and Jim Warny preparing for a scene

Much of the actual cave rescue took part in extremely difficult conditions, a snaking system of water-filled caverns and crevices.

This also presented some challenges for the film crew.

"It was both a technical and logistical challenge to achieve the underwater scenes successfully," Waller says.

However, it helped that some of his crew were experienced divers.

"We were able to recreate authentic conditions with the poor visibility and light coming from just from head lamps. It will feel as if you're really immersed in those tunnels with the rescuers."

Meanwhile, for some of the rescuers, being on set in front of cameras may have been the real challenge.

Waller says: "I think the rescue divers found the filming more difficult than actual cave diving!"

Image copyright Fredrik Divall/De Warrenne Pictures Image caption The crew filmed in other caves in Thailand

The majority of the filming was done in locations in Thailand, including Chiang Rai province, although there were also scenes in Ireland, Wales, China, Japan and Hawaii.

The crew filmed in a number of caves that they considered suitable to depict Tham Luang cave, says Waller.

"We tried to involve the local community as much as possible, and many of the extras travelled long distances to be a part of the production."

His team also requested permission to feature the 12 cave boys in the film but are waiting for a decision from the Ministry of Culture, he says.

The Thai government is protective of the boys, and all interviews with them need approval from a government committee.

Image copyright The Cave Image caption Veteran Thai actor Nirut Sirijanya is part of the cast

Viewers can expect cameos from some of those involved in the rescue, but there will also be faces familiar to Thai audiences.

Veteran actor Nirut Sirijanya, known internationally for his role in The Hangover Part II, is part of the cast, although Waller is keeping his role a secret for now.

"Everyone assumed he's playing Governor Narongsak, but he's actually not - he has a small but important role in the film."

Image copyright Fredrik Divall/De Warrenne Pictures

The film is due for release on the first anniversary of the rescue in July 2019.

All pictures copyright