Page MenuHome

Separate Calculations for Adaptive Scrambling Distance for Viewport and Final Render
AbandonedPublic

Authored by Alaska (Alaska) on Oct 28 2021, 2:18 AM.

Details

Summary

Currently the Adpative Scrambling Distance is calculated based off of the sample count of the final render, but that value can be used in viewport rendering if the option is enabled. As such, basing the Adpative Scrambling Distance off of the sample count of the final render (which by default is higher than viewport rendering) can lead to more corrolation artifacts that would be expected in the viewport.

This patch addresses this issue by calculating the Adpative Scrambling Distance based off of the sample count of the current render mode (viewport or final render).

Diff Detail

Repository
rB Blender
Branch
viewport-adaptive-sd-calculation (branched from master)
Build Status
Buildable 18280
Build 18280: arc lint + arc unit

Event Timeline

Alaska (Alaska) requested review of this revision.Oct 28 2021, 2:18 AM
Alaska (Alaska) created this revision.
Alaska (Alaska) updated this revision to Diff 44053.EditedOct 28 2021, 2:38 AM
  • Add limit to avoid divide by zero situations in adaptive scrambling distance calculations
Alaska (Alaska) added a comment.EditedOct 28 2021, 2:38 AM

One current limitation is that if the sample count is set to 0 in the viewport (infinite sampling), then Adaptive Scrambling Strength isn't calculated properly. I have added limits in place max(get_int(cscene, "samples"), 1) to avoid getting divide by zero cases which could break something at some point.

Alaska (Alaska) edited the summary of this revision. (Show Details)Oct 28 2021, 7:48 AM
Alaska (Alaska) edited the summary of this revision. (Show Details)

This does fix the issue but I wonder if when samples is zero we should choose a much higher value because in that case in the limit anyway scrambling distance should go towards 0 and be 4? What do you think?

Alaska (Alaska) added a comment.EditedOct 28 2021, 9:35 AM

This does fix the issue but I wonder if when samples is zero we should choose a much higher value because in that case in the limit anyway scrambling distance should go towards 0 and be 4? What do you think?

We can pick a higher value. 4096 could be a good value to use?
4 / sqrt(4096) = 0.0625

What's the best way of doing this?

if samples == 0 {
   samples = 4096;
}

Yes maybe or do we have a best pick value for the scrambling distance for the best speed vs render quality? If not then 4096 seems good. You should put in a explanation so that it's does not seem like just a random number. Something like most renders use 4096 samples as that seems the be the upper limit on time vs quality and also this seems to produce nicer images than other values. Anyway you get the idea.

Yes maybe or do we have a best pick value for the scrambling distance for the best speed vs render quality? If not then 4096 seems good. You should put in a explanation so that it's does not seem like just a random number. Something like most renders use 4096 samples as that seems the be the upper limit on time vs quality and also this seems to produce nicer images than other values. Anyway you get the idea.

When the sample count is set to 0 viewport rendering will render "indefinitely" (until we reach the limit set by the format the sample count is stored in). As such I usually use this setting when trying to pick a good value for my final render or when I want to see what an image looks like "fully converged" by just letting it run while I'm doing other stuff.

Based on this "viewport renders indefinitely" statement, in theory we should just set the scrambling distance to 0. However with the value set to 0, it can take a really long time for corrolation artifacts to fade to a point they're not noticable. So a non-zero for scrambling distance is prefered. Deciding which value is "best" is a hard one. I believe setting the scrambling distance to 0.0625 by overriding the sample count to for the algorithm to 4096 is a good option as it brings the scrambling distance close to 0, resulting in increased performance, but keeps the value far enough away from 0 to allow corrolation artifacts to fade away "relatively quickly".

A scrambling distace of 0.0625 is also the value used with the code as it is in master if you took a default scene, and enabled adaptive scrambling and viewport scrambling

I will summarise this for a code comment.

  • Add override for case of samples = 0
  • Change wording of comment
Alaska (Alaska) abandoned this revision.EditedMar 15 2022, 9:59 PM

This changes from this patch has been implemented in combination with another patch. rB630d2b649741: Cycles: allow Adaptive Sampling with Scrambling Distance