depth fade node and fresnel will do exactly what you want for flat surfaces, might need tweaking for more complex stuff