Hamlet, Willy Loman and … the Joker?

In recent years, the DC Comics villain has morphed from a funny, cartoonish miscreant, as embodied by Cesar Romero and Jack Nicholson, into a twisted, coldhearted killer.

A psychopath.

With that shift toward realism, the Joker is now the role of a lifetime. The part has reaped newfound acclaim — even netting one actor an Oscar for its psychological complexity.

The latest performer to don the weighty clown makeup is Joaquin Phoenix in “Joker,” out Friday.

Of his prep for the role, Phoenix told the crowd at the Venice Film Festival, “You start to go mad.”

Here are some of the wild ways the last three Jokers got into character.

Heath Ledger, “The Dark Knight”

It was Heath Ledger’s 2008 performance that first brought the Joker from part to art. And it wasn’t a laugh riot.

Director Christopher Nolan’s tense re-envisioning of the Batman story in “The Dark Knight” turned the criminal into a demented terrorist who attacked a realistic metropolis, sending videos of his victims’ deaths. In preparation, the late Ledger immersed himself in his character’s corroded mind.

Co-star Christian Bale described what it was like filming an interrogation scene with Ledger, in which the actor asked to get hurt for real.

“The more I beat [the Joker], the more he enjoys it — the more I’m giving him satisfaction. Heath was behaving in a very similar fashion,” Bale told The Hollywood Reporter. “He was slamming himself around, and there were tiled walls inside of that set which were cracked and dented from him hurling himself into them.”

To get deeper in the heathen’s headspace, Ledger, then 26, first confined himself to a hotel room for six weeks before filming — having little to no interaction, reading comic books and meditating. He also kept a Joker journal with photos of Alex DeLarge from “A Clockwork Orange,” hyenas and inspirational words. A documentary called “Heath Ledger: Too Young To Die” revealed a list on one page that read: “Land mines; AIDS; Beloved pets in bad road accidents; Statistics; BRUNCH!; The Periodic Table of the Elements.”

Ledger, who died six months before the movie hit cinemas, won a posthumous Best Supporting Actor Oscar for his turn.

Jared Leto, “Suicide Squad”

Isolation is a major theme for these Batman baddies. On the set of “Suicide Squad,” Jared Leto, who was made up to appear like a drug addict with bloodshot eyes and rotting teeth, acted like a hermit.

“I’ve never actually met Jared Leto,” co-star Will Smith told Apple Beats Radio 1. “We worked together for six months and we’ve never exchanged a word outside of ‘Action!’ and ‘Cut!’ ”

Remaining constantly in character for the 2016 film, the then-44-year-old Leto also upped the creep factor in his on-set behavior. Viola Davis said he started off the shoot by sending the cast an unusual gift.

“[A] henchman came in with a dead pig and plopped it on the table and then he walked out,” she told Vanity Fair. “And that was our introduction to Jared Leto.”

He then gave Margot Robbie a live black rat in a box. Wanting to match his level of commitment, the actress reportedly kept it.

Joaquin Phoenix, “Joker”

The latest actor to play the clown prince, Phoenix is already well-known for disappearing behind roles.

On an infamous 2009 “Late Show With David Letterman” interview, he pretended to be a crazy, dazed version himself who announced he was leaving acting for rap. Letterman bought it, and viewers assumed the bit was real for months. However, it was actually performance art for a fake documentary called “I’m Still Here.”

For “Joker,” his process was more relaxed — and not so scary as his predecessors’.

“It wasn’t just the torment,” Phoenix, 44, told a crowd at the Venice Film Festival of playing the Joker, who has been reimagined as a failed stand-up comic. “It was the joy, his struggle to find happiness and to feel connected. To have warmth and love.”

But Phoenix also understood he wasn’t playing a sweetheart. The actor studied a book about the psychology of assassins, and drastically changed his shirt size, losing more than 50 pounds for the role.

“[Weight loss] has a drastic effect on you not just physically, but emotionally and mentally as well when you enter into that starvation mode,” he told the Toronto Sun.