To do that in 3D you would need something similar to a Z-buffer so that only the closest transparent pixels are shown, not those behind (which could create issues). I don't know how feasible this is...
You could also do that at geometry level but it would be slower.
In 2D, same story. If there is no Z-buffer, you need a buffer at some point to accumulate those objects in an "unshaded" manner and draw them afterwards using transparency on the whole.