Fix T75287: other Cycles render passes wrong when using Cryptomatte

This commit is contained in:
Brecht Van Lommel 2020-04-03 01:47:23 +02:00
parent 82a8da0ec3
commit 80513d8574
Notes: blender-bot 2023-02-14 10:43:47 +01:00
Referenced by issue #75287, Cycles render passes have channels from other passes appearing in them.
2 changed files with 14 additions and 13 deletions

View File

@ -260,15 +260,16 @@ def list_render_passes(srl):
if crl.use_pass_volume_indirect: yield ("VolumeInd", "RGB", 'COLOR')
# Cryptomatte passes.
crypto_depth = (crl.pass_crypto_depth + 1) // 2
if crl.use_pass_crypto_object:
for i in range(0, crl.pass_crypto_depth, 2):
yield ("CryptoObject" + '{:02d}'.format(i//2), "RGBA", 'COLOR')
for i in range(0, crypto_depth):
yield ("CryptoObject" + '{:02d}'.format(i), "RGBA", 'COLOR')
if crl.use_pass_crypto_material:
for i in range(0, crl.pass_crypto_depth, 2):
yield ("CryptoMaterial" + '{:02d}'.format(i//2), "RGBA", 'COLOR')
for i in range(0, crypto_depth):
yield ("CryptoMaterial" + '{:02d}'.format(i), "RGBA", 'COLOR')
if srl.cycles.use_pass_crypto_asset:
for i in range(0, srl.cycles.pass_crypto_depth, 2):
yield ("CryptoAsset" + '{:02d}'.format(i//2), "RGBA", 'COLOR')
for i in range(0, crypto_depth):
yield ("CryptoAsset" + '{:02d}'.format(i), "RGBA", 'COLOR')
# Denoising passes.
if crl.use_denoising or crl.denoising_store_passes:

View File

@ -633,12 +633,12 @@ vector<Pass> BlenderSync::sync_render_passes(BL::RenderLayer &b_rlay,
/* Cryptomatte stores two ID/weight pairs per RGBA layer.
* User facing parameter is the number of pairs. */
int crypto_depth = min(16, get_int(crp, "pass_crypto_depth"));
int crypto_depth = divide_up(min(16, get_int(crp, "pass_crypto_depth")), 2);
scene->film->cryptomatte_depth = crypto_depth;
scene->film->cryptomatte_passes = CRYPT_NONE;
if (get_boolean(crp, "use_pass_crypto_object")) {
for (int i = 0; i < crypto_depth; i += 2) {
string passname = cryptomatte_prefix + string_printf("Object%02d", i / 2);
for (int i = 0; i < crypto_depth; i++) {
string passname = cryptomatte_prefix + string_printf("Object%02d", i);
b_engine.add_pass(passname.c_str(), 4, "RGBA", b_view_layer.name().c_str());
Pass::add(PASS_CRYPTOMATTE, passes, passname.c_str());
}
@ -646,8 +646,8 @@ vector<Pass> BlenderSync::sync_render_passes(BL::RenderLayer &b_rlay,
CRYPT_OBJECT);
}
if (get_boolean(crp, "use_pass_crypto_material")) {
for (int i = 0; i < crypto_depth; i += 2) {
string passname = cryptomatte_prefix + string_printf("Material%02d", i / 2);
for (int i = 0; i < crypto_depth; i++) {
string passname = cryptomatte_prefix + string_printf("Material%02d", i);
b_engine.add_pass(passname.c_str(), 4, "RGBA", b_view_layer.name().c_str());
Pass::add(PASS_CRYPTOMATTE, passes, passname.c_str());
}
@ -655,8 +655,8 @@ vector<Pass> BlenderSync::sync_render_passes(BL::RenderLayer &b_rlay,
CRYPT_MATERIAL);
}
if (get_boolean(crp, "use_pass_crypto_asset")) {
for (int i = 0; i < crypto_depth; i += 2) {
string passname = cryptomatte_prefix + string_printf("Asset%02d", i / 2);
for (int i = 0; i < crypto_depth; i++) {
string passname = cryptomatte_prefix + string_printf("Asset%02d", i);
b_engine.add_pass(passname.c_str(), 4, "RGBA", b_view_layer.name().c_str());
Pass::add(PASS_CRYPTOMATTE, passes, passname.c_str());
}