implemented painter's algorithm for fake-z index