For some of us, the tragic death of Robin Williams yesterday brought into sharper relief the darkness that was often lurking at the edges of his work — even some of his most beloved comedies.

Sometimes these movies veered into sentiment, sometimes they became classics, and sometimes they managed to do both.

There have been many remembrances, and it’s true that at times his stand-up and his TV appearances displayed an edge and a raucousness that his film career didn’t always capture.

But the fact is that Williams leaves behind a cinematic legacy that we’ll still be talking about many decades from now. In that name, we have made a list of some of his finest works, as a tribute to the art he so vigorously created.

15. What Dreams May Come (1998)

A profoundly earnest and troubled film that’s rather reviled by many, Vincent Ward’s “What Dreams May Come” was seen at the time as another example of Williams doing absurdly sentimental fare that didn’t properly utilize his talents and further dulled his edge.

But this is a haunting, and haunted, film: It’s about a man who finds himself in Heaven and then tries to save his beloved wife from Hell after he finds out she committed suicide. And that’s not even the half of it: He needs help from the spirits of his dead kids to do so.

The film was tampered with in post, and it shows. But it’s also full of moments of stunning sadness and beauty, and if you manage to get on its wavelength, you’ll find that Williams is quite heartbreaking in it.

From all those tear-jerking scenes, the father-to-son talk takes the first place for the amount of emotions in it. “What Dreams May Come” may be particularly painful to watch now, as it follows Williams’ character Chris Nielsen on his exploration of the afterlife after the death of his wife. His conversation with his son, knowing the enormity of what they’ve both lost, is both heartbreaking and heartwarming.