Maniphest T46108

Cycles - Overlapping emissive volumes generat unexpected bright hotspots around the intersection.
Closed, Resolved

Assigned To
Sergey Sharybin (sergey)
Authored By
Mark Allen (PrimeNine)
Sep 14 2015, 3:00 PM
Tags
  • BF Blender
  • Cycles
Subscribers
Brecht Van Lommel (brecht)
Mark Allen (PrimeNine)
Sergey Sharybin (sergey)
Thomas Dinges (dingto)

Description

System Information
tested on two systems with identical results:
Windows 7, Intel Xeon quadcore & GTX 770
Windows 10, Intel Ivy bridge Quadcore & GTX 980

Blender Version
Tested on 2.75a, unknown before that.

Short description of error
Overlapping emissive volumes cause unexpected bright spots in the image, This is exacerbated by large steps sizes.

It can be compensated for by either using a clamp direct value or very small step size, however both of these can compromise image quality/render time significantly - this feels like an artifact we shouldn't have to work around? Understood if low priority though.

Exact steps for others to reproduce the error
Using attached .blend:

just render default camera (CPU or GPU generate the same problem). Artifacts become visible after the first few dozen samples. Looks like:

(may need to enlarge to see)

The setup is simple, default scene with the cube and lights removed, set to cycles render. Two spheres with a constant volume emission (at this case 0.1 strength), and a camera positioned so that the spheres occlude each other. Around the intersection patch we get a bright white circle.

Note that in this example I've increased volume sampling step size to 1, which is quite large but serves to demonstrate the point. In other projects I'm working on I've seen issue with steps as low as 0.05 even for large scenes (over ~100m distances, which is an incredibly long render!). I've also occasionally seen dark spots around emissive-volume intersection points, but have been unable to nail down accurate repro steps, will update if I do).

Revisions and Commits

rC Cycles
D2212
rB Blender
D2212

Event Timeline

Mark Allen (PrimeNine) created this task.Sep 14 2015, 3:00 PM
Mark Allen (PrimeNine) raised the priority of this task from to 90.
Mark Allen (PrimeNine) updated the task description.
Mark Allen (PrimeNine) added a project: BF Blender.
Mark Allen (PrimeNine) edited a custom field.
Mark Allen (PrimeNine) added a subscriber: Mark Allen (PrimeNine).
Thomas Dinges (dingto) claimed this task.Sep 15 2015, 9:15 PM
Thomas Dinges (dingto) added a project: Cycles.Sep 15 2015, 9:23 PM
Thomas Dinges (dingto) added a comment.Sep 16 2015, 2:21 PM

Does not happen with Branched Path, there it's fine. I am wondering why the Step Size affects this, it should not as this is a homogeneous volume.

Mark Allen (PrimeNine) added a comment.Sep 16 2015, 2:53 PM

Have just done a quick retest on the uploaded file, not sure if the extra info will help - on the intel Xeon/GTX 770 machine from before. I'm looking in the viewport rather than final render, but I'm not aware of differences. There does appear to be a difference between CPU+Branched Path and all other mixes of CPU/GPU & Branched/Normal:

GPU:
I do still see the same artifacts in Branched Path here. Using 4 samples (with x1 in all specific categories) and a step size of 1 I can see a dozen bright spots around the circle, more do seem to appear with more samples. Using a step of 0.01 (rather extreme) and watching the render one sample at a time the artifacts do show up in the first few samples (in the same pixels as before), but are much dimmer and get cleaned up by the averaging across samples very quickly.

This looks to be consistent with what I'm seeing in normal path tracing with the same sample/step count.

CPU:
If I switch to CPU rendering, path tracing behaves exactly the same and shows up these artifacts. Branched Path as you say looks flawless, at any step size I've tried (0.01, 0.1, 1 are all fine). Decidedly weird.

Idle musing: I did wonder (as a programmer but blender newb) if it's running into a numerical inaccuracy, missing the geometry at the intersection and assuming some "maximum" brightness over the volume step when this issue occurs, so a longer step contributes more overall light to the pixel than a short step.

Thomas Dinges (dingto) lowered the priority of this task from 90 to 50.Sep 18 2015, 12:40 AM
Brecht Van Lommel (brecht) added a subscriber: Brecht Van Lommel (brecht).Sep 20 2015, 10:58 PM

It's most likely a ray intersection precision issue, where we miss an intersection and as a result assume the volume extends to infinity. This means it will hit the Max Steps, and with a larger step size that distance will be larger, leading to more emission.

The precision issue would be fixed ideally, but perhaps it's also a good idea to discard volumes segments with no finite exit point.

Sergey Sharybin (sergey) added a subscriber: Sergey Sharybin (sergey).Sep 21 2015, 4:08 PM

This actually happens with both branched and regular path tracers here. We talked with @Thomas Dinges (dingto) about roots of the issue in the IRC, but worth dumping some thoughts here.

Basically, what's most likely is happening is wrong volume stack when ray hits close enough to the intersection. This could happen due to two reasons:

  1. Ray leaves first volume and ray_offset() pushes ray inside second volume, which leads to a missing volume enter event.
  2. Ray enters first volume, keeps traversing and hits exact (in machine precision terms) intersection of two volumes. It's undefined which volume will be picked up here, could be any of them. This will either lead to a missing volume enter event (similar to 1) or will lead to missing volume exit event (causing bright spots).

Surely discarding volumes which are extended to infinity will solve bright spots from appearing, but it's just a partial problem caused by precision issues. We still wouldn't be able to deal with missing volume enter event.

Not sure we'll technically consider this a bug tho, precision issues happens here and there..

Brecht Van Lommel (brecht) added a comment.Sep 27 2015, 1:48 AM

This issue could also be fixed by recording all transparent intersections along a ray instead of just the first. We've discussed that as an optimization before, but it would also help with this precision issue.

Sergey Sharybin (sergey) added a comment.Jan 25 2016, 5:15 PM

Seems some help here is needed. So here's a quick patch which implements the idea of ignoring volumes with no exit point (one of the possible ways to go with that at least):

1diff --git a/intern/cycles/kernel/kernel_path.h b/intern/cycles/kernel/kernel_path.h
2index 650e3b0..657fb5d 100644
3--- a/intern/cycles/kernel/kernel_path.h
4+++ b/intern/cycles/kernel/kernel_path.h
5@@ -675,6 +675,14 @@ ccl_device_inline float4 kernel_path_integrate(KernelGlobals *kg,
6 #endif
7
8 #ifdef __VOLUME__
9+ if(!hit && state.volume_stack[0].shader != SHADER_NONE) {
10+ if(kernel_data.background.volume_shader != SHADER_NONE) {
11+ state.volume_stack[1].shader = SHADER_NONE;
12+ }
13+ else {
14+ state.volume_stack[0].shader = SHADER_NONE;
15+ }
16+ }
17 /* volume attenuation, emission, scatter */
18 if(state.volume_stack[0].shader != SHADER_NONE) {
19 Ray volume_ray = ray;

But that opens other types of questions, like whether volume was never exit since we missed some event or because we've run out of camera clipping distance and actual exit will happen later and currently it's all fine.

As for recording all transparent intersections: we talked it about it in context of camera rays. While it's possible to get all transparent intersections for camera ray in regular integrator, there'll be some open issues still:

  • Implementing intersect_all for GPU will mean bumping memory usage quite a bit again, alternatively GPU will have the artifact unsolved
  • It wouldn't work for secondary rays

So perhaps it should be both: recording all transparent intersections for camera rays and then still have volume stack "validation", so secondary rays and GPU are still free from really visible artifacts.

Brecht Van Lommel (brecht) moved this task from Backlog to Reliability on the Cycles board.Feb 21 2016, 3:05 PM
Brecht Van Lommel (brecht) moved this task from Reliability to Backlog on the Cycles board.Feb 21 2016, 3:15 PM
Sergey Sharybin (sergey) added a comment.Jun 7 2016, 12:58 PM

@Thomas Dinges (dingto), are you actually looking into the report still?

Thomas Dinges (dingto) added a comment.Jun 7 2016, 4:19 PM

Haven't looked into this since last years EGSR. Still think it's worth to implement "intersect all transparent" for camera rays.

Sergey Sharybin (sergey) added a comment.Jun 8 2016, 3:13 PM

That wouldn't solve the root of the problem -- you'll still have fireflies when secondary ray hits those points. It is still required some trickery to avoid infinite volumes.

If you want i can steal this report and continue with those tricks i've mentioned above.

Thomas Dinges (dingto) reassigned this task from Thomas Dinges (dingto) to Sergey Sharybin (sergey).Jun 8 2016, 3:48 PM
Thomas Dinges (dingto) added a subscriber: Thomas Dinges (dingto).

Feel free :)

Sergey Sharybin (sergey) added a comment.Sep 8 2016, 5:21 PM

After looking a lot in the behavior of volume with different camera setups (especially, when clipping distance is inside the volume) came to conclusion current render results aren't really correct anyway (at least from own tests). So perhaps introducing some behavior difference is not that bad.

Finished the proposed change in D2212, let's move discussion there.

Sergey Sharybin (sergey) changed the task status from Unknown Status to Resolved by committing rBdd58390d71d7: Fix emissive volumes generates unexpected fireflies around intersections.Dec 8 2016, 5:51 PM
Sergey Sharybin (sergey) added a commit: rBdd58390d71d7: Fix emissive volumes generates unexpected fireflies around intersections.
Sergey Sharybin (sergey) added a commit: rC5df06c149994: Fix emissive volumes generates unexpected fireflies around intersections.Dec 12 2016, 1:54 PM