i'm trying to recall when i went from "i want to remembered as this great person" to "i'm dead, why would it make a difference?" to "ok, it would probably not be a bad thing if somehow people become happier/inspired/etc etc if i died". the last one does sound weird, but it's really is kind of the only thing that would remotely matter.
i suppose it's a bit of a continuum. the difficult part is realizing that, regardless of whether there's an afterlife or not, whether anyone remembers me, the way i should live my life should really be the same.