diffrp.utils.light_transport#

diffrp.utils.light_transport.fresnel_schlick_smoothness(cos_theta: Tensor, f0: Tensor, smoothness: Tensor)#
diffrp.utils.light_transport.geometry_schlick_ggx(n_dot_v: Tensor, roughness: Tensor)#
diffrp.utils.light_transport.geometry_smith(n: Tensor, v: Tensor, L: Tensor, roughness: Tensor)#
diffrp.utils.light_transport.hammersley(n: int, deterministic: bool = False, device: device | None = None)#
diffrp.utils.light_transport.importance_sample_ggx(x: Tensor, y: Tensor, n: Tensor, roughness: float | Tensor)#

GGX Importance Sampling. Samples a batch of rays if roughness is a single float value, or samples a single ray for each (broadcastable) element if roughness is a tensor.

Parameters:
  • x (torch.Tensor) – sample sequence element 1, shape (n) in [0, 1) if roughness is float, otherwise shape (…, 1) when roughness is tensor.

  • y (torch.Tensor) – sample sequence element 2, shape (n) in [0, 1) if roughness is float, otherwise shape (…, 1) when roughness is tensor.

  • n (torch.Tensor) – (batched) normal vectors, shape (…, 3).

  • roughness (float | torch.Tensor) – the roughness level, single value or tensor of shape (…, 1) in (0, 1].

Returns:

sampled ray directions, shape (n, …, 3) if roughness is float, otherwise shape (…, 3).

Return type:

torch.Tensor

diffrp.utils.light_transport.irradiance_integral_env_map(env: Tensor, premip_resolution: int = 64, base_resolution: int = 16)#
diffrp.utils.light_transport.normal_distribution_function_ggx(n_dot_h: Tensor, roughness: float)#
diffrp.utils.light_transport.pre_integral_env_brdf()#
diffrp.utils.light_transport.prefilter_env_map(env: Tensor, base_resolution: int = 256, num_levels: int = 5, num_samples: int = 512, deterministic: bool = False)#