Cryptomatte DecoderΒΆ

[1]:
import logging
logging.basicConfig(level=logging.DEBUG)

import graphcat.notebook
import imagecat
[2]:
mapping = {
    "CryptoPreview": {"role": imagecat.data.Role.RGB, "selection": ["uCryptoMaterial.red", "uCryptoMaterial.green", "uCryptoMaterial.blue"]},
}

graph = graphcat.DynamicGraph()
imagecat.add_task(graph, "/load", imagecat.operator.load, path="bunny_CryptoMaterial.exr")
imagecat.add_task(graph, "/preview", imagecat.operator.remap, mapping=mapping)
imagecat.add_links(graph, "/load", ("/preview", "image"))

graphcat.notebook.display(graph)
image = graph.output("/preview")
../_images/user-guide_cryptomatte_2_0.svg
INFO:imagecat.operator:Task /load load:
INFO:imagecat.operator:  layers: *
INFO:imagecat.operator:  path: bunny_CryptoMaterial.exr
INFO:imagecat.operator:  output: Image(uCryptoMaterial.blue: Layer(Role.NONE 1280x720x1 float32), uCryptoMaterial.green: Layer(Role.NONE 1280x720x1 float32), uCryptoMaterial.red: Layer(Role.NONE 1280x720x1 float32), uCryptoMaterial00.alpha: Layer(Role.NONE 1280x720x1 float32), uCryptoMaterial00.blue: Layer(Role.NONE 1280x720x1 float32), uCryptoMaterial00.green: Layer(Role.NONE 1280x720x1 float32), uCryptoMaterial00.red: Layer(Role.NONE 1280x720x1 float32), uCryptoMaterial01.alpha: Layer(Role.NONE 1280x720x1 float32), uCryptoMaterial01.blue: Layer(Role.NONE 1280x720x1 float32), uCryptoMaterial01.green: Layer(Role.NONE 1280x720x1 float32), uCryptoMaterial01.red: Layer(Role.NONE 1280x720x1 float32), uCryptoMaterial02.alpha: Layer(Role.NONE 1280x720x1 float32), uCryptoMaterial02.blue: Layer(Role.NONE 1280x720x1 float32), uCryptoMaterial02.green: Layer(Role.NONE 1280x720x1 float32), uCryptoMaterial02.red: Layer(Role.NONE 1280x720x1 float32))
INFO:imagecat.operator:Task CryptoPreview remap:
INFO:imagecat.operator:  mapping: {'CryptoPreview': {'role': <Role.RGB: 1>, 'selection': ['uCryptoMaterial.red', 'uCryptoMaterial.green', 'uCryptoMaterial.blue']}}
INFO:imagecat.operator:  output: Image(CryptoPreview: Layer(Role.RGB 1280x720x3 float32))
[3]:
image.layers["CryptoPreview"]
[3]:
../_images/user-guide_cryptomatte_3_0.png
[4]:
graph.output("/load").metadata
[4]:
{'CameraFilmApertureHorizontal': 1.0,
 'CameraFilmApertureVertical': 0.5625,
 'CameraFocalLength': 0.9890166521072388,
 'arnold/AA_samples': 10,
 'arnold/auto_transparency_depth': 10,
 'arnold/diffuse_depth': 1,
 'arnold/diffuse_samples': 0,
 'arnold/glossy_depth': 1,
 'arnold/glossy_samples': 0,
 'arnold/host/hw': '2 x Intel(R) Xeon(R) CPU E5645 @ 2.40GHz (12 cores, 24 logical) with 24567MB',
 'arnold/host/name': 'NYMRNDR108',
 'arnold/host/os': 'Windows 7 Professional Service Pack 1 (version 6.1, build 7601)',
 'arnold/reflection_depth': 2,
 'arnold/refraction_depth': 2,
 'arnold/refraction_samples': 0,
 'arnold/sss_samples': 3,
 'arnold/stats/date': 'Tue Mar 01 19:29:05 2016',
 'arnold/stats/geo/curve_segments': 1095000.0,
 'arnold/stats/geo/triangles': 125766.0,
 'arnold/stats/memory/peak': 8468.72265625,
 'arnold/stats/memory/start': 367.5078125,
 'arnold/stats/rays/all/pixel': 1062.9029541015625,
 'arnold/stats/rays/all/total': 1043855808.0,
 'arnold/stats/rays/camera/pixel': 96.8963851928711,
 'arnold/stats/rays/camera/total': 95160000.0,
 'arnold/stats/time/render': 591.790771484375,
 'arnold/stats/time/setup': 6.202756881713867,
 'arnold/texture_max_memory_MB': 999999.0,
 'arnold/threads': 24,
 'arnold/total_depth': 10,
 'arnold/version': 'Arnold 4.2.11.1 windows icc-14.0.2 oiio-1.5.20 rlm-11.3.1 2015/11/18 13:42:29',
 'arnold/volume_depth': 0,
 'arnold/volume_samples': 0,
 'capDate': '2016:03:01 19:29:05',
 'channels': {'uCryptoMaterial.blue': ['FLOAT', 1, 1],
  'uCryptoMaterial.green': ['FLOAT', 1, 1],
  'uCryptoMaterial.red': ['FLOAT', 1, 1],
  'uCryptoMaterial00.alpha': ['FLOAT', 1, 1],
  'uCryptoMaterial00.blue': ['FLOAT', 1, 1],
  'uCryptoMaterial00.green': ['FLOAT', 1, 1],
  'uCryptoMaterial00.red': ['FLOAT', 1, 1],
  'uCryptoMaterial01.alpha': ['FLOAT', 1, 1],
  'uCryptoMaterial01.blue': ['FLOAT', 1, 1],
  'uCryptoMaterial01.green': ['FLOAT', 1, 1],
  'uCryptoMaterial01.red': ['FLOAT', 1, 1],
  'uCryptoMaterial02.alpha': ['FLOAT', 1, 1],
  'uCryptoMaterial02.blue': ['FLOAT', 1, 1],
  'uCryptoMaterial02.green': ['FLOAT', 1, 1],
  'uCryptoMaterial02.red': ['FLOAT', 1, 1]},
 'compression': 'ZIPS_COMPRESSION',
 'compressionName': 'Zip (1 scanline)',
 'cryptomatte/xc7bccc/conversion': 'uint32_to_float32',
 'cryptomatte/xc7bccc/hash': 'MurmurHash3_32',
 'cryptomatte/xc7bccc/manifest': '{"Material10":"83ae4666","Material11":"8131354e","Material12":"758b1edb","Material7":"b5c7aeb6","Material8":"dd5dc347","Material9":"d1d42e32","ai_bad_shader":"b3e5341b","bunny_porcelain_mat":"b24b26d4","flowerA_petal":"4f6ba831","flowerB_petal":"be02d5cc","flowerStem_mat":"7f0f6696","grass_mat":"41c3eaf9","ground_mat":"ee25e74e","smallLeaf_mat":"c607dc0c","smallStalk_mat":"7ec9f550"}',
 'cryptomatte/xc7bccc/name': 'uCryptoMaterial',
 'dataWindow': [0, 0, 1279, 719],
 'displayWindow': [0, 0, 1279, 719],
 'lineOrder': 'INCREASING_Y',
 'nuke/full_layer_names': 0,
 'nuke/node_hash': '52b1af4c323e1b16',
 'nuke/version': '10.0v5',
 'pixelAspectRatio': 1.0,
 'screenWindowCenter': [0.0, 0.0],
 'screenWindowWidth': 1.0,
 'type': 'scanlineimage',
 'version': 1,
 'worldToCamera': None,
 'worldToNDC': None}
[5]:
imagecat.add_task(graph, "/cryptomatte", imagecat.operator.cryptomatte.decoder, clown=False, mattes=["bunny_porcelain_mat"])
imagecat.add_links(graph, "/load", ("/cryptomatte", "image"))

graphcat.notebook.display(graph)
image = graph.output("/cryptomatte")
../_images/user-guide_cryptomatte_5_0.svg
INFO:imagecat.operator.cryptomatte:Task /cryptomatte cryptomatte.decode:
INFO:imagecat.operator.cryptomatte:  clown: False
INFO:imagecat.operator.cryptomatte:  cryptomatte: None
INFO:imagecat.operator.cryptomatte:  layer: M
INFO:imagecat.operator.cryptomatte:  mattes: ['bunny_porcelain_mat']
INFO:imagecat.operator.cryptomatte:  output: Image(M: Layer(Role.MATTE 1280x720x1 float32))
[6]:
image.layers["M"]
[6]:
../_images/user-guide_cryptomatte_6_0.png
[7]:
graph.set_task("/cryptomatte/mattes", graphcat.constant(["flowerA_petal", "flowerB_petal"]))
image = graph.output("/cryptomatte")
INFO:imagecat.operator.cryptomatte:Task /cryptomatte cryptomatte.decode:
INFO:imagecat.operator.cryptomatte:  clown: False
INFO:imagecat.operator.cryptomatte:  cryptomatte: None
INFO:imagecat.operator.cryptomatte:  layer: M
INFO:imagecat.operator.cryptomatte:  mattes: ['flowerA_petal', 'flowerB_petal']
INFO:imagecat.operator.cryptomatte:  output: Image(M: Layer(Role.MATTE 1280x720x1 float32))
[8]:
image.layers["M"]
[8]:
../_images/user-guide_cryptomatte_8_0.png
[9]:
graph.set_task("/cryptomatte/clown", graphcat.constant(True))
graph.set_task("/cryptomatte/mattes", graphcat.constant(["bunny_porcelain_mat","flowerA_petal","flowerB_petal","flowerStem_mat","grass_mat","ground_mat","smallLeaf_mat","smallStalk_mat"]))
image = graph.output("/cryptomatte")
INFO:imagecat.operator.cryptomatte:Task /cryptomatte cryptomatte.decode:
INFO:imagecat.operator.cryptomatte:  clown: True
INFO:imagecat.operator.cryptomatte:  cryptomatte: None
INFO:imagecat.operator.cryptomatte:  layer: M
INFO:imagecat.operator.cryptomatte:  mattes: ['bunny_porcelain_mat', 'flowerA_petal', 'flowerB_petal', 'flowerStem_mat', 'grass_mat', 'ground_mat', 'smallLeaf_mat', 'smallStalk_mat']
INFO:imagecat.operator.cryptomatte:  output: Image(M: Layer(Role.RGB 1280x720x3 float32))
[10]:
image.layers["M"]
[10]:
../_images/user-guide_cryptomatte_10_0.png