As directors Ron Clements and John Musker were putting together their latest Disney animated film “Moana” three years ago, they sought a songwriter for their film about a young Polynesian woman with dreams of being navigator on an adventure with a cocky demigod.

They flew out to New York to meet with some of the top Broadway composers and lyricists around, including a local talent famous for his Tony-winning show “In the Heights” named Lin-Manuel Miranda.

“We did meet at the time with Lin before most anybody in the world knew about ‘Hamilton,’” Clements says. “Lin was really passionate and smart and had a lot of great ideas and we liked him a lot.”

Miranda did mention to them, briefly, that he was working on a show for the Public Theater, a hip-hop version of the story of Alexander Hamilton.

“We were kind of at a loss of what to make of that,” Clements admits. “He’ll be involved with that for a few weeks and then it will kind of disappear and he can focus on this. But what do we know? All we knew was that he was a talented guy and the right man for the job. And that was like a bolt of lightning that we were so lucky to be hit by.”

Luck is certainly something that the duo had while making “Moana,” as perhaps the biggest actor around right now is Polynesian.

“The easiest character to cast was Dwayne Johnson, we thought of him right away for Maui,” Musker says. “He has roots in the South Pacific, he’s larger than life and he was excited about being part of this. He also has cool tattoos that tell his story.”

Clements says that Johnson himself was kind of a demigod.

“He’s so big in real life,” he says. “It felt very natural for us and he was very excited about the possibility of having to sing a song.”

Casting Johnson was an easy decision. Finding an actress to voice Moana was not.

They eventually landed on Auli’i Cravalho, a 15-year-old Hawaiian native, who at the time was a high school freshman. She is so new to the industry that her page lists exactly one credit: “Moana.”

“The hardest character to cast was Moana,” Clements says. “That was an intense search. There were hundreds. It was an open call, so there were literally hundreds of people submitting audition tapes, there were things on YouTube, they went to our casting agents.”

The search went out across New Zealand, Samoa and Hawaii, but they couldn’t find the perfect combination of age, singing ability, voice appeal and acting ability — not to mention those more undefinable star qualities.

The old cliché is that what you’re searching for is always in the last place you look, and that’s what happened with Cravalho.

A casting director, who remembered the young actress from a tape she submitted for a nonprofit charity event, encouraged Carvalho’s mother to bring her in for an audition, singing a song in Hawaiian and doing a couple of scenes from the movie.

“We loved what Auli’i did,” Clements says. “And the rest is history.”