Page MenuHome

Cycles X: tweak adaptive sampling threshold
ClosedPublic

Authored by Brecht Van Lommel (brecht) on Sep 3 2021, 8:08 PM.
Tags
None
Subscribers
None
Tokens
"Love" token, awarded by Raimund58."Love" token, awarded by ace_dragon."Love" token, awarded by Alaska."Love" token, awarded by HEYPictures.

Details

Summary
  • Fix incorrect handling of samples in adaptive sampling threshold. The previous formula relied on number of samples cancelling out, but this was not the case.
  • Base automatic min samples on the adaptive threshold instead of number of samples, since we now consider that the main setting to tweak.

Note this changes noise levels in existing renders and requires thresholds to be
tweaked again.

I could not find a significant upside or downsides in scenes when comparing equal
render times. Mainly what this seems to do is make different scenes behave more
consistently with the same noise threshold.

Diff Detail

Repository
rB Blender
Branch
sample-settings (branched from master)
Build Status
Buildable 16812
Build 16812: arc lint + arc unit

Event Timeline

Brecht Van Lommel (brecht) requested review of this revision.Sep 3 2021, 8:08 PM
Brecht Van Lommel (brecht) created this revision.

Suggested tweak to the comment wording. But trust to apply the tweak without extra review iteration.

intern/cycles/render/integrator.cpp
306–307

Referencing code state from somewhere in the past is always weird and puzzling. Such information is more suitable to the patch description/commit message.

Alternative wording could be something:

Arbitrary factor that makes the threshold more similar to the adaptive sampling termination which compared accumulated image buffers (without scaling the buffer down). Also gives arguably more intuitive values.

Just disambiguate "before", make it clear from reading the comment without digging the history.

This revision is now accepted and ready to land.Sep 6 2021, 12:13 PM

You don't need the inv_sample as it would cancel out in the expression. Also the 0.0001 to stop a divide by zero seems relatively large compared to the error threshold of 0.001 it's only a factor of 10.

intern/cycles/kernel/kernel_adaptive_sampling.h
73–81

You don't need to divide by inv_sample as that term would cancel out at error_difference/error_normalise ignoring the 0.0001f

Brecht Van Lommel (brecht) marked an inline comment as done.Sep 6 2021, 7:42 PM

Also the 0.0001 to stop a divide by zero seems relatively large compared to the error threshold of 0.001 it's only a factor of 10.

Probably it can be lowered to 0.00001 but not much more due to numerical precision. 0.0001 might already be low enough that you can't reach that kind of threshold with a realistic number of samples for real world scenes.

intern/cycles/kernel/kernel_adaptive_sampling.h
73–81

I don't think it cancels out since it evaluates to inv_sample / sqrtf(inv_sample)? That factor is what made the threshold behavior unpredictable previously.