Psyop / Cryptomatte

Cryptomatte Nuke plugin, Fusion plugin, sample images, and specification
BSD 3-Clause "New" or "Revised" License
637 stars 152 forks source link

Motionblur #68

Closed tokejepsen closed 6 years ago

tokejepsen commented 6 years ago

I'm trying to separate a cg object from others with motionblur. This is to represent separating a character from the shadows in a beauty render, to comp onto a plate. The issue I'm having is there is a lot of spill between the mattes, which results in a separation between the shadow and the cg objects.

ep0010_sh0010_lighting_v0001_write1 0001 ep0010_sh0010_lighting_v0001.zip

I've attached all the files for the image above: Maya scene, an Arnold render (AlShaders 2) and a Nuke script.

Is Cryptomatte expected to handle this?

jonahfriedman commented 6 years ago

The answer to your main question is- not really. The output of Cryptomatte is a shallow matte that only tells you what proportion of any given pixel is covered by your selection.

You have one layer containing two objects, which you are comping over a checkerboard. You seem to be trying to separate those two objects into their own layers, and then compositing them back into 1 with some "over" operations. Due to how "over"s work, this wouldn't work even if you had rendered the two spheres separately. (I think, but may be wrong, that this would not even work with separately rendered sphere as deep images).

To modify one of the spheres (the intention of cryptomatte), I would use a comp like the attached one. There are no artifacts for the pixels containing only sphere and background, and only mild ones for the pixels containing two spheres). Note the use of the "premultiply" flag and puttting the matte into a custom channel.

set cut_paste_input [stack 0]
version 10.0 v6
Read {
 inputs 0
 file C:/Users/jfriedman/Downloads/ep0010_sh0010_lighting_v0001/ep0010_sh0010_lighting_v0001.0001.exr
 format "960 540 0 0 960 540 1 "
 origset true
 name Read3
 selected true
 xpos -385
 ypos -269
 addUserKnob {20 submit_tab l Publish}
 addUserKnob {4 submission_preset l "Submission Preset" M {"proxy-qt\t1/4 Res Quicktime" "anim-dailies\tAnimation Dailies" "cg-dailies\tCG Dailies" "dailies\tDailies" "dont-transcode\tDon't Transcode"}}
 submission_preset dailies
 addUserKnob {22 submit_gui l "Polaris (GUI)" -STARTLINE T NodeSubmission.do_submission_gui()}
 addUserKnob {22 submit l Publish -STARTLINE T NodeSubmission.do_submission()}
 addUserKnob {6 pass_frange l "Pass frame range to transgen" +STARTLINE}
 addUserKnob {43 description l Description}
 addUserKnob {4 qube_priority l "Qube Priority" M {lowest low normal high highest}}
 qube_priority normal
}
add_layer {mattteLayer mattteLayer.red}
add_layer {crypto_material00 crypto_material00.red crypto_material00.green crypto_material00.blue crypto_material00.alpha}
add_layer {crypto_material01 crypto_material01.red crypto_material01.green crypto_material01.blue crypto_material01.alpha}
add_layer {crypto_material02 crypto_material02.red crypto_material02.green crypto_material02.blue crypto_material02.alpha}
Cryptomatte {
 name Cryptomatte2
 selected true
 xpos -385
 ypos -164
 previewEnabled false
 matteOutput mattteLayer
 matteList aiStandardSurface2
 cryptoLayer crypto_material
 expression "((crypto_material00.red == 9.82133692745e-29) ? crypto_material00.green : 0.0) + ((crypto_material00.blue == 9.82133692745e-29) ? crypto_material00.alpha : 0.0) + ((crypto_material01.red == 9.82133692745e-29) ? crypto_material01.green : 0.0) + ((crypto_material01.blue == 9.82133692745e-29) ? crypto_material01.alpha : 0.0) + ((crypto_material02.red == 9.82133692745e-29) ? crypto_material02.green : 0.0) + ((crypto_material02.blue == 9.82133692745e-29) ? crypto_material02.alpha : 0.0) + 0"
 keyedName ""
 previewExpression0 ""
 previewExpression1 ""
 previewExpression2 ""
 previewExpression3 ""
 previewChannel none
 in00 crypto_material00
 in01 crypto_material01
 in02 crypto_material02
 in03 none
 in04 none
 in05 none
 in06 none
 in07 none
}
HueShift {
 color_saturation 4
 hue_rotation 30
 maskChannelInput mattteLayer.red
 name HueShift1
 selected true
 xpos -385
 ypos -90
}
CheckerBoard2 {
 inputs 0
 format "960 540 0 0 960 540 1 "
 name CheckerBoard2
 selected true
 xpos -237
 ypos -325
}
Merge2 {
 inputs 2
 name Merge5
 selected true
 xpos -237
 ypos -84
}
tokejepsen commented 6 years ago

Thanks @jonahfriedman :)

You are right about it that you can even do just with Arnold. We'll continue with rendering full shadows instead.