Page MenuHome

Cycles: improved rounding of sample chunks for resumable renders
ClosedPublic

Authored by Sybren A. Stüvel (sybren) on Tue, Jan 29, 6:09 PM.

Details

Summary

When using --cycles-resumable-num-chunks N to render a subset of the
samples, having N close to the total number of samples causes rounding
issues.

For example, a file configured for 250 samples and 150 chunks should
have 1.6666 sample per chunk. The old code rounded this to 2 samples per
chunk, which would result in too many samples being rendered. When
rendering a single chunk this doesn't matter much, but when larger chunk
ranges are rendered with --cycles-resumable-start-chunk and
--cycles-resumable-end-chunk the rounding errors start to add up.

By multiplying with the number of chunks to render first, and only round
to integers after that, this issue is solved. In the above example,
rendering 3 chunks will correctly render 5 samples rather than 6.

Diff Detail

Repository
rB Blender

Event Timeline

Sybren A. Stüvel (sybren) marked an inline comment as done.Tue, Jan 29, 6:10 PM
Sybren A. Stüvel (sybren) added inline comments.
intern/cycles/blender/blender_session.cpp
1430

We can log the rounded numbers here, if you think that's desirable.

This all depends on what exactly we want to achieve here. The code still will not handle 4 total samples split across 10 chunks (if my calculations are correct, range_num_samples will be 0.4, and rounded_range_num_samples).

Probably better idea would be to render at least one sample, and ignore the fact that in some cases the overall number of samples will be higher than requested.
Shouldn't be so much of a problem for sample-merging, since there is a code which sets a metadata for image.

This all depends on what exactly we want to achieve here. The code still will not handle 4 total samples split across 10 chunks (if my calculations are correct, range_num_samples will be 0.4, and rounded_range_num_samples).

True, it won't properly handle more chunks than samples.

Probably better idea would be to render at least one sample, and ignore the fact that in some cases the overall number of samples will be higher than requested.
Shouldn't be so much of a problem for sample-merging, since there is a code which sets a metadata for image.

Fine by me.

  • Guarantee we always render at least one sample

Ok, summary of some discussion here.

No ideal solution is found so far, and this patch is already better than the old code. So just make a warning maybe. Fix the inline comment and go ahead with this.

intern/cycles/blender/blender_session.cpp
1423

Use #include "util/util_algorithm.h" and then max from ccl namespace.

This revision is now accepted and ready to land.Wed, Jan 30, 10:20 AM
  • Print warning to stderr and use ccl::max()
  • #include "util/util_algorithm.h" for completeness
This revision was automatically updated to reflect the committed changes.