Free association has rarely been freer than in the mind of Robin Williams, whose gift for improvisation made him one of the most respected comedians and dramatic actors of his generation. And in “Robin Williams: Come Inside My Mind,” director Marina Zenovich (“Roman Polanski: Wanted and Desired”) pops the hood and shows us some of what made this artist tick.

It’s a film that, early on, feels like a standard catch-a-rising-star celebrity hagiography, but as the story continues — and the impressive line-up of interviewees get deeper into their memories of Williams — the film achieves a balance between celebration and unfiltered recollection. His addictions to cocaine, alcohol and even the very act of getting a laugh are explored by friends and family as well as, in voice-over, by Williams himself in frank archival interviews.

Most fans know the general outline: Marin County kid goes to Juilliard, where John Houseman picks Williams and his roommate Christopher Reeve as his most promising students. Classically-trained improv actor becomes stand-up comedian who jumps from subject to subject to impersonation to outrageous physicality with lightning speed. A one-episode stint as Mork from Ork on the hit sitcom “Happy Days” leads to his own show. The movies, the nanny, the heart surgery, the Parkinson’s diagnosis, and the tragic suicide in 2014 at the age of 63.

See Photos: 'Aladdin' 25th Anniversary: 15 Facts You Probably Didn't Know

Zenovich fills in some of the blanks: Williams grew up spending a lot of time alone, entertaining himself with characters he would create for his toy soldiers. Later, he attended an all-male college and started taking theater classes because they were the only ones that were co-ed.

And then there’s the film’s impressive array of interviews: David Letterman recalls thinking that he’d picked perhaps the worst time to move to L.A. to become a comedian after seeing Williams onstage. Elayne Boosler talks about being Williams’ girlfriend while acknowledging his need to have other women, including another girlfriend in San Francisco, Valerie Velardi, who eventually became his first wife.

Also Read: Robin Williams Mooned 'Hook' Cast to Prank Spielberg, Actor Says

Eric Idle and Billy Crystal and Steve Martin speak in awe about Williams’ gifts while acknowledging his personal demons. (Crystal recalls Williams’ dependence on audience response, noting he always needed “that one extra-special hug you can only get from a stranger.”) Pam Dawber remembers having to tell Williams that John Belushi died of an overdose not long after Williams had visited him.

Velardi reveals that her privacy kept her from correcting press reports at the time that Williams had left her for their former nanny, Marsha Garces, even though Velardi and Williams had already been separated for a year and that Garces hadn’t worked in that capacity for them in quite some time. It’s an overdue correction, but it’s also understandable that she would have wanted to avoid that media scrum at the time. (Velardi and Williams’ son Zak also shares touching memories of his dad.)

Also Read: Robin Williams' Widow on His Struggle With Neural Disease: 'He Had Chemical Warfare in His Brain'

“Come Inside My Mind” offers some revealing bloopers (the Elmo/”Sesame Street” outtakes are priceless) that demonstrate Williams’ unique train of thought and how he was always reaching for some beautiful moment of truth and absurdity. You would expect him to be cutting up between takes of, say, “Patch Adams” (it’s a little heartbreaking to see the late Philip Seymour Hoffman lose his composure), but it’s jarring to see Williams shtick it up on the set of the intense “One Hour Photo” — director Mark Romanek recalls that Williams just had to get the wackiness out of his system, and the relaxed glow he got after getting a laugh fed into his dramatic focus.

Apart from one radio interview with Williams’ friend (and “World’s Greatest Dad” director) Bobcat Goldthwait, “Come Inside My Mind” doesn’t spend quite enough time explaining the connections between the Lewy body dementia (brought on by the Parkinson’s) that led to his suicide. It also would have helped if any of the stand-up or movie clips peppered throughout featured years alongside the titles to let those less acquainted with his career know where and when we are over the course of his life.

These are minor drawbacks, however, to a film that’s compassionate without being fawning, and poignant without being sentimental. It’s less a lament over his loss and more a celebration that he existed at all.