Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/intern
diff options
context:
space:
mode:
authorBrecht Van Lommel <brecht@blender.org>2021-10-05 17:33:29 +0300
committerBrecht Van Lommel <brecht@blender.org>2021-10-06 15:21:11 +0300
commit18c6314e2660820778c555143b234dff3ba35ffa (patch)
tree2a7400be7ef0b68c065de8ccf2fd6e9a6ef91fda /intern
parent3c4537cd38f715485826d5db040afe776c958861 (diff)
Cleanup: don't detect duplicate intersections in Embree
It's unclear why this code was added in the first place, but it seems unnecessary, it can be restored if we find this breaks something. The Embree docs mention that the same primitive may be hit multiple times, but my understanding is that about e.g. curves where both the frontside and backside may be hit. However those hits would be at different distances. The context for this change is that we want to add an optimization where we can immediately update throughput for transparent shadows instead of recording intersections, and avoid duplicate would require extra work. However there is an Embree example that does something similar without worrying about duplicate hits either.
Diffstat (limited to 'intern')
-rw-r--r--intern/cycles/bvh/bvh_embree.cpp21
1 files changed, 1 insertions, 20 deletions
diff --git a/intern/cycles/bvh/bvh_embree.cpp b/intern/cycles/bvh/bvh_embree.cpp
index 9250af419cb..eebc1e1e547 100644
--- a/intern/cycles/bvh/bvh_embree.cpp
+++ b/intern/cycles/bvh/bvh_embree.cpp
@@ -89,20 +89,9 @@ static void rtc_filter_occluded_func(const RTCFilterFunctionNArguments *args)
/* Test if we need to record this transparent intersection. */
if (ctx->num_hits < ctx->max_hits || ray->tfar < ctx->max_t) {
- /* Skip already recorded intersections. */
- int num_recorded_hits = min(ctx->num_hits, ctx->max_hits);
-
- for (int i = 0; i < num_recorded_hits; ++i) {
- if (current_isect.object == ctx->isect_s[i].object &&
- current_isect.prim == ctx->isect_s[i].prim && current_isect.t == ctx->isect_s[i].t) {
- /* This intersection was already recorded, skip it. */
- *args->valid = 0;
- return;
- }
- }
-
/* If maximum number of hits was reached, replace the intersection with the
* highest distance. We want to find the N closest intersections. */
+ const int num_recorded_hits = min(ctx->num_hits, ctx->max_hits);
int isect_index = num_recorded_hits;
if (num_recorded_hits + 1 >= ctx->max_hits) {
float max_t = ctx->isect_s[0].t;
@@ -213,14 +202,6 @@ static void rtc_filter_occluded_func(const RTCFilterFunctionNArguments *args)
if (ctx->num_hits < ctx->max_hits) {
Intersection current_isect;
kernel_embree_convert_hit(kg, ray, hit, &current_isect);
- for (size_t i = 0; i < ctx->num_hits; ++i) {
- if (current_isect.object == ctx->isect_s[i].object &&
- current_isect.prim == ctx->isect_s[i].prim && current_isect.t == ctx->isect_s[i].t) {
- /* This intersection was already recorded, skip it. */
- *args->valid = 0;
- break;
- }
- }
Intersection *isect = &ctx->isect_s[ctx->num_hits];
++ctx->num_hits;
*isect = current_isect;