1
$\begingroup$

Is there a way to control the sample rate or disable specific pixels in Blender using Python API? Is there a way for example to access the sample map and either disable the pixel or set the number of samples for that pixel to zero? I want to avoid rendering these pixels, so adding a mask post-rendering is not something that I am looking for.

Any help or guidance would be greatly appreciated.

$\endgroup$

1 Answer 1

0
$\begingroup$

EEVEE and Cycles do not have functionality for sampling masks so there is no way to use non-existing functionality from Blender's Python API as well. For Cycles you could use View Layers to render multiple layers with different samples.

You can define what objects are visible in view layer with masks:

enter image description here

You can override sample amount per view layer:

enter image description here

You should use adaptive sampling so that blank areas do not get fully sampled while rendering separate layers.

enter image description here

Here is how it could work:

enter image description here

Setting this up with Python is possible, however it depends on your specific situation a lot, so it is hard to provide examples.

$\endgroup$
2
  • $\begingroup$ Thanks for the answer, but this solution would put different objects on different layers, what I am looking for is to control this on the image plane and control each pixel individually. $\endgroup$ Mar 8 at 13:16
  • $\begingroup$ I understand. Maxwell and Octane render engines have this functionality, but unfortunately, you cannot do that with EEVEE or Cycles. You can make a mask out of geometry with holdout shader in front of the camera and use adaptive sampling to only sample it a few times. $\endgroup$ Mar 9 at 15:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.