[Bf-blender-cvs] [0aa151f8349] soc-2022-many-lights-sampling: Remove file that was renamed in last refactor

Brecht Van Lommel noreply at git.blender.org
Tue Oct 25 15:54:20 CEST 2022


Commit: 0aa151f8349b7024faaf69bfc4501a3fbcb38cbb
Author: Brecht Van Lommel
Date:   Tue Oct 25 15:53:09 2022 +0200
Branches: soc-2022-many-lights-sampling
https://developer.blender.org/rB0aa151f8349b7024faaf69bfc4501a3fbcb38cbb

Remove file that was renamed in last refactor

===================================================================

D	intern/cycles/kernel/light/light_tree.h

===================================================================

diff --git a/intern/cycles/kernel/light/light_tree.h b/intern/cycles/kernel/light/light_tree.h
deleted file mode 100644
index 5eedcd9081d..00000000000
--- a/intern/cycles/kernel/light/light_tree.h
+++ /dev/null
@@ -1,1032 +0,0 @@
-#pragma once
-
-#include "kernel/light/light.h"
-
-CCL_NAMESPACE_BEGIN
-
-/* TODO: this seems like a relative expensive computation, and we can make it a lot cheaper
- * by using a bounding sphere instead of a bounding box. This will be more inaccurate, but it
- * might be fine when used along with the adaptive splitting. */
-ccl_device float light_tree_cos_bounding_box_angle(const float3 bbox_min,
-                                                   const float3 bbox_max,
-                                                   const float3 P,
-                                                   const float3 N,
-                                                   const float3 point_to_centroid,
-                                                   ccl_private bool &bbox_is_visible)
-{
-  float cos_theta_u = 1.0f;
-  /* Iterate through all 8 possible points of the bounding box. */
-  for (int i = 0; i < 8; ++i) {
-    const float3 corner = make_float3((i & 1) ? bbox_max.x : bbox_min.x,
-                                      (i & 2) ? bbox_max.y : bbox_min.y,
-                                      (i & 4) ? bbox_max.z : bbox_min.z);
-
-    /* Caculate the bounding box angle. */
-    float3 point_to_corner = normalize(corner - P);
-    cos_theta_u = fminf(cos_theta_u, dot(point_to_centroid, point_to_corner));
-
-    /* Figure out whether or not the bounding box is in front or behind the shading point. */
-    bbox_is_visible |= dot(point_to_corner, N) > 0;
-  }
-  return cos_theta_u;
-}
-
-/* This is the general function for calculating the importance of either a cluster or an emitter.
- * Both of the specialized functions obtain the necessary data before calling this function. */
-ccl_device void light_tree_cluster_importance(const float3 N,
-                                              const bool has_transmission,
-                                              const float3 point_to_centroid,
-                                              const float cos_theta_u,
-                                              const float3 bcone_axis,
-                                              const float inv_max_distance_squared,
-                                              const float inv_min_distance_squared,
-                                              const float theta_o,
-                                              const float theta_e,
-                                              const float energy,
-                                              ccl_private float &max_importance,
-                                              ccl_private float &min_importance)
-{
-  max_importance = 0.0f;
-  min_importance = 0.0f;
-
-  const float cos_theta = dot(bcone_axis, -point_to_centroid);
-  const float cos_theta_i = has_transmission ? fabsf(dot(point_to_centroid, N)) :
-                                               dot(point_to_centroid, N);
-  const float sin_theta_i = safe_sqrtf(1.0f - sqr(cos_theta_i));
-  const float sin_theta_u = safe_sqrtf(1.0f - sqr(cos_theta_u));
-
-  /* cos_min_incidence_angle = cos(max{theta_i - theta_u, 0}), also cos(theta_i') in the paper*/
-  const float cos_min_incidence_angle = cos_theta_i > cos_theta_u ?
-                                            1.0f :
-                                            cos_theta_i * cos_theta_u + sin_theta_i * sin_theta_u;
-  /* If the node is guaranteed to be behind the surface we're sampling, and the surface is opaque,
-   * then we can give the node an importance of 0 as it contributes nothing to the surface.
-   * This is more accurate than the bbox test if we are calculating the importance of an emitter
-   * with radius */
-  if (!has_transmission && cos_min_incidence_angle < 0) {
-    return;
-  }
-
-  /* cos(theta - theta_u) */
-  const float sin_theta = safe_sqrtf(1.0f - sqr(cos_theta));
-  const float cos_theta_minus_theta_u = cos_theta * cos_theta_u + sin_theta * sin_theta_u;
-
-  float cos_theta_o, sin_theta_o;
-  fast_sincosf(theta_o, &sin_theta_o, &cos_theta_o);
-
-  float cos_min_outgoing_angle; /* minimum angle an emitter’s normal would form with the direction
-                                 to the shading point, cos(theta') in the paper */
-
-  if ((cos_theta > cos_theta_u) || (cos_theta_minus_theta_u > cos_theta_o)) {
-    /* theta - theta_o - theta_u < 0 */
-    kernel_assert((fast_acosf(cos_theta) - theta_o - fast_acosf(cos_theta_u)) < 5e-4f);
-    cos_min_outgoing_angle = 1.0f;
-  }
-  else if ((cos_theta > cos_theta_u) || (theta_o + theta_e > M_PI_F) ||
-           (cos_theta_minus_theta_u > cos(theta_o + theta_e))) {
-    /* theta' = theta - theta_o - theta_u < theta_e */
-    kernel_assert((fast_acosf(cos_theta) - theta_o - fast_acosf(cos_theta_u) - theta_e) < 5e-4f);
-    const float sin_theta_minus_theta_u = safe_sqrtf(1.0f - sqr(cos_theta_minus_theta_u));
-    cos_min_outgoing_angle = cos_theta_minus_theta_u * cos_theta_o +
-                             sin_theta_minus_theta_u * sin_theta_o;
-  }
-  else {
-    return;
-  }
-
-  /* TODO: find a good approximation for f_a. */
-  const float f_a = 1.0f;
-  max_importance = fabsf(f_a * cos_min_incidence_angle * energy * inv_min_distance_squared *
-                         cos_min_outgoing_angle);
-
-  if (inv_max_distance_squared == inv_min_distance_squared) {
-    min_importance = max_importance;
-    return;
-  }
-
-  /* cos_max_incidence_angle = cos(min{theta_i + theta_u, pi}) */
-  const float cos_max_incidence_angle = fmaxf(
-      cos_theta_i * cos_theta_u - sin_theta_i * sin_theta_u, 0.0f);
-
-  /* cos(theta + theta_o + theta_u) if theta + theta_o + theta_u < theta_e, 0 otherwise */
-  float cos_max_outgoing_angle;
-  const float cos_theta_plus_theta_u = cos_theta * cos_theta_u - sin_theta * sin_theta_u;
-  if (theta_e - theta_o < 0 || cos_theta < 0 || cos_theta_u < 0 ||
-      cos_theta_plus_theta_u < cos(theta_e - theta_o)) {
-    min_importance = 0.f;
-  }
-  else {
-    const float sin_theta_plus_theta_u = safe_sqrtf(1.0f - sqr(cos_theta_plus_theta_u));
-    cos_max_outgoing_angle = cos_theta_plus_theta_u * cos_theta_o -
-                             sin_theta_plus_theta_u * sin_theta_o;
-    min_importance = fabsf(f_a * cos_max_incidence_angle * energy * inv_max_distance_squared *
-                           cos_max_outgoing_angle);
-  }
-}
-
-/* This is uniformly sampling the reservoir for now. */
-ccl_device float light_tree_emitter_reservoir_weight(KernelGlobals kg,
-                                                     const float3 P,
-                                                     const float3 N,
-                                                     int emitter_index)
-{
-  if (emitter_index < 0) {
-    return 0.0f;
-  }
-
-  ccl_global const KernelLightTreeEmitter *kemitter = &kernel_data_fetch(light_tree_emitters,
-                                                                         emitter_index);
-  const int prim = kemitter->prim_id;
-
-  /* Triangles are handled normally for now. */
-  if (prim < 0) {
-    const int lamp = -prim - 1;
-
-    const ccl_global KernelLight *klight = &kernel_data_fetch(lights, lamp);
-    float3 light_P = make_float3(klight->co[0], klight->co[1], klight->co[2]);
-
-    /* We use a special calculation to check if a light is
-     * within the bounds of a spot or area light. */
-    if (klight->type == LIGHT_SPOT) {
-      const float radius = klight->spot.radius;
-      const float cos_theta = klight->spot.spot_angle;
-      const float theta = fast_acosf(cos_theta);
-      const float3 light_P = make_float3(klight->co[0], klight->co[1], klight->co[2]);
-      const float3 light_dir = make_float3(
-          klight->spot.dir[0], klight->spot.dir[1], klight->spot.dir[2]);
-
-      const float h1 = radius * fast_sinf(theta);
-      const float d1 = radius * cos_theta;
-      const float h2 = d1 / fast_tanf(theta);
-
-      const float3 apex = light_P - (h1 + h2) * light_dir;
-      const float3 apex_to_point = normalize(P - apex);
-      if (dot(apex_to_point, light_dir) < cos_theta) {
-        return 0.0f;
-      }
-    }
-    else if (klight->type == LIGHT_AREA) {
-      float3 axisu = make_float3(
-          klight->area.axisu[0], klight->area.axisu[1], klight->area.axisu[2]);
-      float3 axisv = make_float3(
-          klight->area.axisv[0], klight->area.axisv[1], klight->area.axisv[2]);
-      float3 Ng = make_float3(klight->area.dir[0], klight->area.dir[1], klight->area.dir[2]);
-      bool is_round = (klight->area.invarea < 0.0f);
-
-      if (dot(light_P - P, Ng) > 0.0f) {
-        return 0.0f;
-      }
-
-      if (!is_round) {
-        if (klight->area.tan_spread > 0.0f) {
-          if (!light_spread_clamp_area_light(
-                  P, Ng, &light_P, &axisu, &axisv, klight->area.tan_spread)) {
-            return 0.0f;
-          }
-        }
-      }
-    }
-  }
-
-  return 1.0f;
-}
-
-ccl_device void light_tree_emitter_importance(KernelGlobals kg,
-                                              const float3 P,
-                                              const float3 N,
-                                              const bool has_transmission,
-                                              int emitter_index,
-                                              ccl_private float &max_importance,
-                                              ccl_private float &min_importance)
-{
-  ccl_global const KernelLightTreeEmitter *kemitter = &kernel_data_fetch(light_tree_emitters,
-                                                                         emitter_index);
-
-  float3 bcone_axis = make_float3(kemitter->bounding_cone_axis[0],
-                                  kemitter->bounding_cone_axis[1],
-                                  kemitter->bounding_cone_axis[2]);
-  float theta_o = kemitter->theta_o;
-  float cos_theta_u, inv_max_distance_squared, inv_min_distance_squared;
-  float3 point_to_centroid;
-  bool bbox_is_visible = has_transmission;
-
-  const int prim = kemitter->prim_id;
-  if (prim < 0) {
-    const int lamp = 

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list