Page MenuHome

Cycles: Add sample offset option
ClosedPublic

Authored by Andrii Symkin (pembem22) on Nov 3 2021, 12:43 PM.

Details

Summary

This patch exposes the sampling offset option to Blender. It is located in the "Sampling > Advanced" panel.
For example, this can be useful to parallelize rendering and distribute different chunks of samples for each computer to render.


I also had to add this option to RenderWork and RenderScheduler classes so that the sample count in the status string can be calculated correctly.

Diff Detail

Repository
rB Blender
Branch
cycles-x-sample-offset
Build Status
Buildable 18443
Build 18443: arc lint + arc unit

Event Timeline

Andrii Symkin (pembem22) requested review of this revision.Nov 3 2021, 12:43 PM
Andrii Symkin (pembem22) created this revision.
Brecht Van Lommel (brecht) requested changes to this revision.Nov 3 2021, 1:55 PM
Brecht Van Lommel (brecht) added inline comments.
intern/cycles/blender/addon/ui.py
243

Move it to the Advanced panel, this is not something that users should be tweaking often manually.

intern/cycles/blender/sync.cpp
847โ€“849

The clamping should be the other way around I think, seems better to render fewer samples than lower the sample offset and rendering the same sample multiple times.

params.sample_offset = clamp(params.sample_offset, 0, Integrator::MAX_SAMPLES);
params.samples = clamp(params.samples, 0, Integrator::MAX_SAMPLES - params.sample_offset);
intern/cycles/kernel/film/accumulate.h
148

This should be sample + start_sample.

This revision now requires changes to proceed.Nov 3 2021, 1:55 PM
  • Move Sample Offset option to the Advanced panel
  • Clamp sample count instead of sample offset
  • Fix incorrect order of samples when sample count layer is enabled
Andrii Symkin (pembem22) marked 2 inline comments as done.Nov 3 2021, 6:47 PM

There were some issues with the order of samples when the sample count layer was enabled. The reason was the sample_start value from the KernelWorkTile class, which I assumed to be constant, but in my case it was being increased during sampling. When added to the value from sample count layer, the resulting value was increased by 2 every sample.

So I've added sample_offset to the KernelWorkTile as well. I've done some tests with different combinations of sample counts and offsets, with and without sample count layer, and the results are correct.

intern/cycles/kernel/film/accumulate.h
148

Sample offset is already accounted for in the sample variable.

  • Fix start_sample_ used instead of sample_offset_
Andrii Symkin (pembem22) edited the summary of this revision. (Show Details)Nov 7 2021, 8:05 PM

This looks good to me and from my checks the samples seem to start at the correct values.

Do you need me to commit this?

Yes, I don't have commit rights. Thanks!

This revision is now accepted and ready to land.Nov 9 2021, 2:26 PM

Hi @William Leeson (leesonw) ๐Ÿ˜„ just checking in to see if there's anything else I can help with here? I've noticed we're close to getting this patch in, which is great. If there's something you need please let me know!

No is should be in now.

This revision was automatically updated to reflect the committed changes.