Looking at a body of work that includes everything from a classic comedy (“Friday”) to hostage thrillers (“The Negotiator”) to high-octane franchise tentpoles (“The Fate of the Furious”), the subject matter of F. Gary Gray’s movies seems to share little in common from one to the next. But the invisible throughline that connects them all is Gray’s remarkable aptitude for finding the least likely actor imaginable and plugging them into an unforgettable role.

From gangsta rapper Ice Cube as a genial straight man in “Friday” to Dwayne Johnson as a gay bodyguard-turned-wannabe actor in “Be Cool” to Charlize Theron as a ruthless cyberterrorist in “Fate of the Furious,” Gray has repeatedly given actors opportunities they’ve never had before, not just challenging them to expand their repertoire, but also changing the way audiences see them on screen.

Cube, for example, was already a co-writer and producer on “Friday” when Gray agreed that he should star as Craig Jones, a UPS driver who inexplicably loses his job on his day off. The success of the film changed the rapper’s public persona virtually overnight, cementing both their fledgling movie careers. It emboldened the director to take more risks on future projects, starting by enlisting Queen Latifah for the female-led heist movie “Set It Off.”

“That was her first major role, and she gives a masterful performance I think should have been nominated for an Oscar,” Gray says. “And then you just start to kind of go down the line casting people you wouldn’t expect. When we did ‘The Negotiator,’ Stallone was a part of the original cast and an amazing guy, but we ended up going with Sam Jackson, who you wouldn’t expect to be in a movie as a cop.”

In the wake of $176 million worldwide box office haul for “The Italian Job,” locking down the ensemble cast of the “Get Shorty” sequel “Be Cool” offered him almost limitless opportunities to get creative with his actors. Johnson had only a handful of credits before playing Eliot Wilhelm; ditto Outkast rapper Andre Benjamin, who played feckless gun-toting gangster Dabu. And after seeing one of Cedric the Entertainer’s standup routines, Gray cast the comedian as Sin LaSalle, a Wharton business school-educated hip-hop producer who also happens to be a crime lord.

“Gary said he saw me do a joke that reminded him of some of the dudes that he knew — not the atypical tough guys, but guys that were intelligent but had this other underground kind of thing,” Cedric says.

Cedric credits Gray not just for guiding him through a challenging role, but showing audiences — and casting agents — what he’s capable of as an actor.

“It gives you great confidence that you can do the work,” he says. “That movie is one we constantly send scenes from whenever I’m trying for a dramatic role.”

Gray’s subsequent casting coups include choosing his “Italian Job” star Theron as the villain of “Fate of the Furious,” reuniting Tessa Thompson with her “Thor: Ragnarok” co-star Chris Hemsworth as the lead in “Men in Black: International,” and finding four unknowns, including Ice Cube’s son O’Shea Jackson Jr., for the leads of his N.W.A biopic “Straight Outta Compton.” But whether those unconventional choices are fully successful, the filmmaker says he’s happy just to shake things up, for himself and for moviegoers.

“I get excited if I can kind of mix it up and turn some of these ideas on their heads by casting different people and seeing what they can do,” Gray says. “You create this spark and sometimes it works, sometimes it doesn’t, but it’s always more interesting to direct and a lot of times more interesting to experience it on the screen when these choices are made.”