"Dallas Buyers" may be one of the most serious-minded dramas to come out of the mainstream movie business this year. Yet its existence illustrates that filmmaking ambition isn't just the result of persistence; it depends on more chance-y factors, like a star looking to redefine himself at the moment a couple of celebrity-minded businessmen have some change in their pockets.

PHOTOS: Hollywood backlot moments

"There are times as a producer when you want to scream 'Why am I doing this,' when the rock you're pushing up a hill rolls on top of you," said Brenner, whose acolyte, Rachel Winter, guided the movie as a producer on set. "And then something comes from out of nowhere to remove it."

McConaughey summed it up this way: "With indie movies, the making it is the easy part. It's everything that comes before."

Even with the money, the challenges were far from over. The production needed to find its Rayon, the cross-dressing man afflicted with AIDS who in the script forms a friendship and a business arrangement with Woodroof. Gael Garcia Bernal had dropped out for family reasons. Other big names weren't so sure about playing a cross-dresser.

Jared Leto, a successful rock star who rarely acted anymore, had less to lose. Vallee barely knew Leto. But in a Skype meeting, Leto appeared in full drag as Rayon. The director was convinced. Meanwhile, Vallee liked Noomi Rapace for the female lead, a doctor who initially fights Woodroof, but he was persuaded to take Jennifer Garner, who others felt would be more commercial.

And then the big battle ground: time and money. Vallee and his manager, Nathan Ross, another of the film's producers, wanted a budget of about $8 million and 40 days to shoot. Yet there was only $5 million and a lightning-quick 25 days. And even that was a stretch, enabled mainly by shooting in rebate-rich Louisiana.

Many directors would have walked, but Vallee stayed. Critics often extol a filmmaker's vision as "uncompromising." But sometimes the art of filmmaking comes down to knowing when to make the calculation that the perfect is the enemy of the good.

In the end, the movie was acquired this spring by Focus Features — a division of the company that, notably, tried unsuccessfully to make it for seven years. Whether the studio and audiences will find that the film resonates in an era when AIDS is far less urgent remains to be seen. (There is something of a boomlet for AIDS-themed period films; Ryan Murphy has been shooting the long-gestating adaptation of Larry Kramer's 1985 play, "The Normal Heart.")

Its fate will of course depend in large part on how filmgoers react to its vision. Several people who've seen "Dallas Buyers" say it has an arty feel, bypassing many of the Hollywood conventions of uplift while bearing other marks of an auteur piece. It is shot, for instance, with no added lighting and no score.

As the production wound down that day in December — one of Hollywood's most famous unproduced scripts now, finally, produced — there was an air of celebration on the set, and dazed disbelief. "I'm not a mystical person, but this feels like a spiritual thing. We got this done because the stars aligned," Ross later said.

"A part of it," McConaughey said as he stood in a fleece denim jacket preparing for his final takes, "has yet to really hit home."

Beaming most was Borten, who after all the ups and downs was watching the execution of the script he and Wallack had, more or less, originally crafted so many years before. Borten was decked out in an unflatteringly extravagant outfit for the gay-club scene, the result of Vallee granting, in his own way, Borten's fervent wish to be an extra in the film. But at the moment the writer didn't seem to mind.

"There's something about this film," Borten said, exhaling as the last of the extras packed up and remaining members of the crew tiredly raised their glasses in celebration. "It gets its hooks into you and won't let you go."

steve.zeitchik@latimes.com