The distance sampling is mostly based on weighted delta tracking from [Monte Carlo Methods for Volumetric Light Transport Simulation] (http://iliyan.com/publications/VolumeSTAR/VolumeSTAR_EG2018.pdf). The recursive Monte Carlo estimation of the Radiative Transfer Equation is \[\langle L \rangle=\frac{\bar T(x\rightarrow y)}{\bar p(x\rightarrow y)}(L_e+\sigma_s L_s + \sigma_n L).\] where \(\bar T(x\rightarrow y) = e^{-\bar\sigma\Vert x-y\Vert}\) is the majorant transmittance between points \(x\) and \(y\), \(p(x\rightarrow y) = \bar\sigma e^{-\bar\sigma\Vert x-y\Vert}\) is the probability of sampling point \(y\) from point \(x\) following exponential distribution. At each recursive step, we randomly pick one of the two events proportional to their weights: * If \(\xi < \frac{\sigma_s}{\sigma_s+\vert\sigma_n\vert}\), we sample scatter event and evaluate \(L_s\). * Otherwise, no real collision happens and we continue the recursive process. The emission \(L_e\) is evaluated at each step. This also removes some unused volume settings from the UI: * "Max Steps" is removed, because the step size is automatically specified by the volume octree. There is a hard-coded threshold `VOLUME_MAX_STEPS` to prevent numerical issues. * "Homogeneous" is automatically detected during density evaluation An option "Unbiased" is added to the UI. When enabled, densities above the majorant are clamped.
93 lines
2.7 KiB
C
93 lines
2.7 KiB
C
/* SPDX-FileCopyrightText: 2011-2022 Blender Foundation
|
|
*
|
|
* SPDX-License-Identifier: Apache-2.0 */
|
|
|
|
#include "kernel/types.h"
|
|
|
|
#ifndef KERNEL_DATA_ARRAY
|
|
# define KERNEL_DATA_ARRAY(type, name)
|
|
#endif
|
|
|
|
/* BVH2, not used for OptiX or Embree. */
|
|
KERNEL_DATA_ARRAY(float4, bvh_nodes)
|
|
KERNEL_DATA_ARRAY(float4, bvh_leaf_nodes)
|
|
KERNEL_DATA_ARRAY(uint, prim_type)
|
|
KERNEL_DATA_ARRAY(uint, prim_visibility)
|
|
KERNEL_DATA_ARRAY(uint, prim_index)
|
|
KERNEL_DATA_ARRAY(uint, prim_object)
|
|
KERNEL_DATA_ARRAY(uint, object_node)
|
|
KERNEL_DATA_ARRAY(float2, prim_time)
|
|
|
|
/* objects */
|
|
KERNEL_DATA_ARRAY(KernelObject, objects)
|
|
KERNEL_DATA_ARRAY(Transform, object_motion_pass)
|
|
KERNEL_DATA_ARRAY(DecomposedTransform, object_motion)
|
|
KERNEL_DATA_ARRAY(uint, object_flag)
|
|
KERNEL_DATA_ARRAY(uint, object_prim_offset)
|
|
|
|
/* cameras */
|
|
KERNEL_DATA_ARRAY(DecomposedTransform, camera_motion)
|
|
|
|
/* triangles */
|
|
KERNEL_DATA_ARRAY(uint, tri_shader)
|
|
KERNEL_DATA_ARRAY(packed_float3, tri_vnormal)
|
|
KERNEL_DATA_ARRAY(packed_uint3, tri_vindex)
|
|
KERNEL_DATA_ARRAY(packed_float3, tri_verts)
|
|
|
|
/* curves */
|
|
KERNEL_DATA_ARRAY(KernelCurve, curves)
|
|
KERNEL_DATA_ARRAY(float4, curve_keys)
|
|
KERNEL_DATA_ARRAY(KernelCurveSegment, curve_segments)
|
|
|
|
/* pointclouds */
|
|
KERNEL_DATA_ARRAY(float4, points)
|
|
KERNEL_DATA_ARRAY(uint, points_shader)
|
|
|
|
/* attributes */
|
|
KERNEL_DATA_ARRAY(AttributeMap, attributes_map)
|
|
KERNEL_DATA_ARRAY(float, attributes_float)
|
|
KERNEL_DATA_ARRAY(float2, attributes_float2)
|
|
KERNEL_DATA_ARRAY(packed_float3, attributes_float3)
|
|
KERNEL_DATA_ARRAY(float4, attributes_float4)
|
|
KERNEL_DATA_ARRAY(uchar4, attributes_uchar4)
|
|
|
|
/* lights */
|
|
KERNEL_DATA_ARRAY(KernelLightDistribution, light_distribution)
|
|
KERNEL_DATA_ARRAY(KernelLight, lights)
|
|
KERNEL_DATA_ARRAY(float2, light_background_marginal_cdf)
|
|
KERNEL_DATA_ARRAY(float2, light_background_conditional_cdf)
|
|
|
|
/* light tree */
|
|
KERNEL_DATA_ARRAY(KernelLightTreeNode, light_tree_nodes)
|
|
KERNEL_DATA_ARRAY(KernelLightTreeEmitter, light_tree_emitters)
|
|
KERNEL_DATA_ARRAY(uint, light_to_tree)
|
|
KERNEL_DATA_ARRAY(uint, object_to_tree)
|
|
KERNEL_DATA_ARRAY(uint, object_lookup_offset)
|
|
KERNEL_DATA_ARRAY(uint, triangle_to_tree)
|
|
|
|
/* particles */
|
|
KERNEL_DATA_ARRAY(KernelParticle, particles)
|
|
|
|
/* shaders */
|
|
KERNEL_DATA_ARRAY(uint4, svm_nodes)
|
|
KERNEL_DATA_ARRAY(KernelShader, shaders)
|
|
|
|
/* lookup tables */
|
|
KERNEL_DATA_ARRAY(float, lookup_table)
|
|
|
|
/* tabulated Sobol sample pattern */
|
|
KERNEL_DATA_ARRAY(float, sample_pattern_lut)
|
|
|
|
/* image textures */
|
|
KERNEL_DATA_ARRAY(TextureInfo, texture_info)
|
|
|
|
/* ies lights */
|
|
KERNEL_DATA_ARRAY(float, ies)
|
|
|
|
/* Volume. */
|
|
KERNEL_DATA_ARRAY(KernelOctreeNode, volume_tree_nodes)
|
|
KERNEL_DATA_ARRAY(KernelOctreeRoot, volume_tree_roots)
|
|
KERNEL_DATA_ARRAY(int, volume_tree_root_ids)
|
|
|
|
#undef KERNEL_DATA_ARRAY
|