ZenDiariesA funeral was the spark of Judd Apatow’s big two-night, four-hour documentary on his comic mentor “The Zen Diaries of Garry Shandling” (HBO, 10 p.m.).

And if Shandling was still around, he’d get the self-deprecating humor in that.

After Shandling died suddenly at 66 a year ago of a blood clot, Apatow quickly put together a handful of documentaries for the memorial service.

“One was about his spirituality. One was about his childhood. One was about ‘The Larry Sanders Show,’ ” Apatow told reporters at the TV Critics Association winter press tour earlier this year.

“People were very moved at the memorial at the speeches and the mini documentaries and by the fact that Garry spent his life trying to heal himself and trying to figure out how to be a better person and to be a kinder person. And people were really inspired. And I thought, is there a way to capture how they felt at the memorial in a documentary?”

HBO, for one, was interested. It was, after all, home to his groundbreaking and still celebrated “Larry Sanders Show.”

“A lot of people at HBO talk about how ‘The Larry Sanders Show’ kind of lit the way for what HBO could be in that it was an example of what happens when you do very high quality work,” Apatow said, “and that helped them identify what HBO should be.”

Apatow worked with a wealth of materials – tapes from early comedy shows and his private life. But mostly there was a whole drawer full of diaries covering 30 years, in which Shandling showed how hard he worked at building his comedy, and how hard he worked at changing his own life too.

In doing so, Apatow was returning a favor that began when as a young kid on Long Island, he used to contact comedians and pick their brain, lying that he was interviewing them for the school paper.

“Back then, you could get an interview with someone,” he said, “because there were no podcasts, there was no Internet, and comedians — no one cared about them at all. So if you asked for an interview with a comic, they would say yes even if you were from a high school. And I talked to Garry on the phone when he just hosted ‘The Tonight Show’ for the first time. This is in, like, 1983.”

They met again nine years later when Apatow was a struggling comedy writer and Shandling hired him for material for his gig hosting the Grammys.

“We became friends, and he asked me to write for ‘The Larry Sanders Show,’ and then he asked me to direct ‘The Larry Sanders Show,’ which was crazy because I never asked him.”

They became close, in part because Apatow grew up in an atheist household and Shandling would talk about spirituality.

“When I met Garry, he talked about Buddhism, and he gave me this book called ‘Transforming Problems into Happiness,’ written by a Buddhist monk. It was about how when bad things happen to you, you should rejoice, because it’s an opportunity to work on yourself and to find out where your blocks are. And I never heard that my entire life,” Apatow said.

“That really changed my life,” he went on. “In addition to talking comedy, he liked to talk a lot about being kind and trying to be a loving person and how to be someone who could connect to people in a real way, and that’s what a lot of the documentary is about — how he became that person.”

His description belies how funny the documentary is as well, simply because of Shandling’s ability to really hone material as well as infusing his performance with certain beliefs.

“It really feels like he read ‘Zen in the Art of Archery,’ and he thought, ‘I can apply these ideas about letting go and just being myself to creativity and writing.’ In his journals, he basically says, ‘When you sit next to Johnny [on ‘The Tonight Show’], just let go completely, and trust that when the time comes, you will think of the right joke,’” Apatow said.

“And I don’t know if Gallagher was thinking that way.”

 

“The Zen Diaries of Garry Shandling” concludes on Tuesday on HBO.