Fix: invalid cryptomatte output image when input is not connected

**How to reproduce:**
1. Add Cryptomatte Node
2. Enable 'Object' render passes
3. Connect Cryptomatte to output (composite or viewer node)
4. Optional: set matte ID
5. (Do not connect input image)
6. Render
7. Observe invalid output image (or assert in debug build)
(see also PR for an example blend file)

Only CPU is affected. The solution follows the behavior of the GPU backend, where the input color of the single value input image is multiplied with the matte result to produce a non constant output.

Pull Request: https://projects.blender.org/blender/blender/pulls/135786
This commit is contained in:
Habib Gahbiche
2025-03-11 14:05:04 +01:00
parent 830342bf8e
commit 9fd67803dc

View File

@@ -544,7 +544,7 @@ class BaseCryptoMatteOperation : public NodeOperation {
output.allocate_texture(domain);
parallel_for(domain.size, [&](const int2 texel) {
float4 input_color = input.load_pixel<float4>(texel);
float4 input_color = input.load_pixel<float4, true>(texel);
float input_matte = matte.load_pixel<float>(texel);
/* Premultiply the alpha to the image. */