def get_alpha(self, ray_samples, rays_d, dists, feature_vector, sdf=None, gradients=None):
        """compute alpha from sdf as in NeuS"""
        inv_variance = self.deviation_network(feature_vector)[:, :1].clip(1e-6, 1e6)  # Single parameter

    
        #gradients = torch.ones_like(rays_d, requires_grad=False, device=rays_d.device)
        true_dot_val = (rays_d * gradients).sum(-1, keepdim=True)  # * calculate
        alpha_inter_ratio = 0.0 
        iter_cos = -(F.relu(-true_dot_val * 0.5 + 0.5) * (1.0 - alpha_inter_ratio) + F.relu(
            -true_dot_val) * alpha_inter_ratio)  # always non-positive

        true_estimate_sdf_half_next = sdf + iter_cos.clip(-10.0, 10.0) * dists.reshape(-1, 1) * 0.5
        true_estimate_sdf_half_prev = sdf - iter_cos.clip(-10.0, 10.0) * dists.reshape(-1, 1) * 0.5

        prev_cdf = torch.sigmoid(true_estimate_sdf_half_prev * inv_variance)
        next_cdf = torch.sigmoid(true_estimate_sdf_half_next * inv_variance)

        p = prev_cdf - next_cdf
        c = prev_cdf

        alpha = ((p + 1e-5) / (c + 1e-5)).clip(0.0, 1.0)

        return alpha
compute alpha from sdf as in NeuS
threestudio/models/geometry/geodream_geometry_volume.py