def enable_depth_peeling(self, number_of_peels=None, occlusion_ratio=None): """Enable depth peeling to improve rendering of translucent geometry. Parameters ---------- number_of_peels : int The maximum number of peeling layers. Initial value is 4 and is set in the ``rcParams``. A special value of 0 means no maximum limit. It has to be a positive value. occlusion_ratio : float The threshold under which the deepth peeling algorithm stops to iterate over peel layers. This is the ratio of the number of pixels that have been touched by the last layer over the total number of pixels of the viewport area. Initial value is 0.0, meaning rendering have to be exact. Greater values may speed-up the rendering with small impact on the quality. """ if number_of_peels is None: number_of_peels = rcParams["depth_peeling"]["number_of_peels"] if occlusion_ratio is None: occlusion_ratio = rcParams["depth_peeling"]["occlusion_ratio"] depth_peeling_supported = check_depth_peeling(number_of_peels, occlusion_ratio) if depth_peeling_supported: self.SetUseDepthPeeling(True) self.SetMaximumNumberOfPeels(number_of_peels) self.SetOcclusionRatio(occlusion_ratio) self.Modified() return depth_peeling_supported
def enable_depth_peeling(self, number_of_peels=5, occlusion_ratio=0.1): """Enable depth peeling.""" if number_of_peels is None: number_of_peels = rcParams["depth_peeling"]["number_of_peels"] depth_peeling_supported = check_depth_peeling(number_of_peels, occlusion_ratio) if depth_peeling_supported: self.SetUseDepthPeeling(True) self.SetMaximumNumberOfPeels(number_of_peels) self.SetOcclusionRatio(occlusion_ratio) return depth_peeling_supported