optimized occlusion function