pre calculate visibility