Hi David,

Although deep-compositing might be the prefered solution you can create Holdouts for your particles if you have the camera (translations) you used to render both CG objects and particles. Using the Camera, you can create a depth pass (if not already existing) using an expression node. Using the depth and a MergeExpression or by substracting the depth channels, you can create a holdout matte. See attached script for further details. You can save the included Holdout (group) node as a gizmo. Don't use the DeepHoldout node if you don't have deep input since it's really slow.

Cheerz,
Mitja


On 24.07.2014 03:57, David Rutherford wrote:
I have searched pretty thoroughly but so far I have not been able to find any information on how to use a world position pass to comp two CG objects together. I have a bunch of test objects rendered with a separate beauty pass and a world position pass and a particle cloud rendered with an embedded world position pass. I want to comp them together so that the particles are merged correctly surrounding the objects both in front and behind. The goal is to do away with hold outs in the particle render.

What is the work-flow for doing this. Do I need more than the world position pass? Is this what is labelled "deep" compositing or is this actually something else.
Any pointers, tips or a link to a tutorial would be greatly appreciated.

David.


#! C:/Program Files/Nuke7.0v5/Nuke7.0.exe -nx
version 7.0 v5
define_window_layout_xml {<?xml version="1.0" encoding="UTF-8"?>
<layout version="1.0">
    <window x="0" y="0" w="1936" h="1050" screen="1">
        <splitter orientation="1">
            <split size="40"/>
            <dock id="" hideTitles="1" activePageId="Toolbar.1">
                <page id="Toolbar.1"/>
            </dock>
            <split size="1876"/>
            <splitter orientation="1">
                <split size="545"/>
                <dock id="" activePageId="DAG.1">
                    <page id="DAG.1"/>
                    <page id="DAG.3"/>
                </dock>
                <split size="1327"/>
                <splitter orientation="2">
                    <split size="793"/>
                    <dock id="" activePageId="Properties.1">
                        <page id="Script Editor.1"/>
                        <page id="Error Console.1"/>
                        <page id="Properties.1"/>
                        <page id="de.hkh.nukeTACTIC.Panel"/>
                    </dock>
                    <split size="192"/>
                    <dock id="" activePageId="Error Console.2">
                        <page id="Error Console.2"/>
                    </dock>
                </splitter>
            </splitter>
        </splitter>
    </window>
    <window x="1920" y="0" w="1920" h="1080" fullscreen="1" screen="0">
        <splitter orientation="2">
            <split size="1080"/>
            <dock id="" activePageId="Viewer.1">
                <page id="Viewer.1"/>
            </dock>
        </splitter>
    </window>
</layout>
}
Root {
 inputs 0
 name C:/Users/Mitja/Desktop/Holdout_from_P.nk
 format "2038 1080 0 0 2038 1080 1 bieneMaja_2K"
 proxy_type scale
 proxy_format "1024 778 0 0 1024 778 1 1K_Super_35(full-ap)"
 int8Lut linear
 int16Lut linear
 views "Left #ff0000
Right #00ff00"
 views_colours true
}
BackdropNode {
 inputs 0
 name BackdropNode1
 tile_color 0x8e8e3800
 label Footage
 note_font_size 42
 xpos -545
 ypos -753
 bdwidth 489
 bdheight 417
}
BackdropNode {
 inputs 0
 name BackdropNode2
 tile_color 0x388e8e00
 label "Create depth from P and Convert depth to 1/z style"
 note_font_size 16
 xpos -558
 ypos -277
 bdwidth 511
 bdheight 291
}
BackdropNode {
 inputs 0
 name BackdropNode3
 tile_color 0x71c67100
 label "Create Holdout and Merge"
 note_font_size 42
 xpos -561
 ypos 61
 bdwidth 515
 bdheight 202
}
Constant {
 inputs 0
 channels rgb
 color {0.8700000048 0.4472624958 0.3378186822 0.7049999833}
 name Constant2
 xpos -146
 ypos -634
}
Sphere {
 translate {0.3350000083 0.3799999952 -0.6399999857}
 name Sphere1
 xpos -146
 ypos -517
}
set N15e2dd00 [stack 0]
Constant {
 inputs 0
 channels rgb
 color {0.1112499982 0.3648999035 0.4449999928 0.7049999833}
 name Constant1
 xpos -404
 ypos -638
}
Cube {
 name Cube1
 xpos -404
 ypos -519
}
set N15e2cf40 [stack 0]
Scene {
 inputs 2
 name Scene1
 xpos -278
 ypos -673
}
Camera2 {
 inputs 0
 translate {10.31969833 2.860922098 7.005442142}
 rotate {-12.99999894 55.39999904 0}
 name Camera1
 xpos -680
 ypos -474
}
set N15e2cbd0 [stack 0]
push $N15e2cbd0
push $N15e2cf40
push 0
ScanlineRender {
 inputs 3
 motion_vectors_type distance
 name ScanlineRender1
 xpos -404
 ypos -469
}
add_layer {P P.X P.Y P.Z P.red P.green P.blue P.alpha}
DepthToPosition {
 inputs 2
 output P
 name DepthToPosition1
 xpos -404
 ypos -387
}
set C15e2d620 [stack 0]
Dot {
 name Dot1
 label CG
 xpos -370
 ypos -193
}
set N15e2e070 [stack 0]
Shuffle {
 in P
 name Shuffle2
 xpos -521
 ypos -128
}
set C218d21d0 [stack 0]
Expression {
 channel3 {none none none depth.Z}
 expr3 "sqrt( pow( ( red - cam_translate.x ) , 2 ) + pow( ( green - 
cam_translate.y ) , 2 ) + pow( ( blue - cam_translate.z ) , 2 ) )"
 name generate_depth_
 xpos -521
 ypos -104
 addUserKnob {20 User}
 addUserKnob {13 cam_translate l "Camera Position"}
 cam_translate {{parent.Camera1.translate.Left} {parent.Camera1.translate.Left} 
{parent.Camera1.translate.Left}}
}
set C10f1a320 [stack 0]
Expression {
 channel3 {none none none depth.Z}
 expr3 "1/ depth.Z"
 name convert_depth
 xpos -521
 ypos -80
}
set C1b0d05e0 [stack 0]
push $N15e2e070
Copy {
 inputs 2
 from0 -rgba.alpha
 to0 -rgba.alpha
 channels depth
 name Copy1
 xpos -404
 ypos -48
}
set C1b0d0950 [stack 0]
set N1b0d0950 [stack 0]
push $N15e2cbd0
push $N15e2cbd0
push $N15e2dd00
push 0
ScanlineRender {
 inputs 3
 motion_vectors_type distance
 name ScanlineRender2
 xpos -146
 ypos -453
}
clone $C15e2d620 {
 inputs 2
 xpos -146
 ypos -376
 selected false
}
Dot {
 name Dot2
 label Particles
 xpos -112
 ypos -199
}
set N15e2e750 [stack 0]
clone $C218d21d0 {
 xpos -263
 ypos -131
 selected false
}
clone $C10f1a320 {
 xpos -263
 ypos -107
 selected false
}
clone $C1b0d05e0 {
 xpos -263
 ypos -83
 selected false
}
push $N15e2e750
clone $C1b0d0950 {
 inputs 2
 xpos -146
 ypos -46
 selected false
}
Group {
 inputs 2
 name Holdout
 help "Creates a holdout from two depth channels (depth must be 1/z style). 
Author: Mitja Müller-Jend\nemail: [email protected]"
 knobChanged "def hideShowKnobs():\n\n    #this = nuke.selectedNode()\n    this 
= nuke.thisNode()\n    \n    knobModes = \{'Compare' : \[ 'depth_erode_size' ], 
'Grade': \['softness', 'offset'] \}\n    method = this\['method'].value()\n\n   
 for knobMode, knobs in knobModes.iteritems():\n        for k in knobs:\n       
     if this.knob(k):\n                this.knob(k).setVisible(method == 
knobMode)\nhideShowKnobs()\n"
 xpos -146
 ypos 133
 addUserKnob {20 holdout_tab l Holdout}
 addUserKnob {4 method l Method t "<b>Compare:</b> Compare depth channels using 
Merge Expression: Az<=Bz?1:0\n<b>Grade:</b> Get Matte from substracting and 
grading depth channels." M {Compare Grade "" "" "" "" "" ""}}
 method Grade
 addUserKnob {26 div1 l Holdout}
 addUserKnob {14 depth_erode_size l "Erode Depth" +HIDDEN R -100 100}
 addUserKnob {19 softness l Softness}
 addUserKnob {19 offset l Offset R -1 1}
 offset {0 0 0 0}
 addUserKnob {26 ""}
 addUserKnob {20 post l "Post Erode/Blur" t "Erode and Blur holdout mask before 
multiplying with alpha." n 1}
 addUserKnob {14 erode l "Erode Mask" R -100 100}
 addUserKnob {6 matrix_blur l "Matrix Blur" +STARTLINE}
 matrix_blur true
 addUserKnob {20 endGroup n -1}
 addUserKnob {26 post_group l INVISIBLE +INVISIBLE T obsolete}
 addUserKnob {26 pre_group l INVISIBLE +INVISIBLE T obsolete}
}
 Input {
  inputs 0
  name BG
  xpos -576
  ypos -553
  number 1
 }
 Dot {
  name Dot3
  xpos -542
  ypos -513
 }
set N9e40d780 [stack 0]
 Shuffle {
  in depth
  name Shuffle1
  xpos -708
  ypos -432
 }
 set C9e3812c0 [stack 0]
 Input {
  inputs 0
  name FG
  xpos -332
  ypos -524
 }
set N9e381630 [stack 0]
 Dot {
  name Dot1
  xpos -841
  ypos -446
 }
clone $C9e3812c0 {
  xpos -875
  ypos -428
  selected false
 }
 Merge2 {
  inputs 2
  operation from
  name Merge14
  xpos -875
  ypos -367
 }
 Grade {
  channels rgba
  whitepoint {{"(parent.softness / 100 )+ 0.00001"}}
  add {{"parent.offset + 0.5"}}
  white_clamp true
  name compare_grade
  xpos -875
  ypos -338
 }
set N9e3823f0 [stack 0]
 Clamp {
  name Clamp1
  xpos -875
  ypos -295
 }
 Dot {
  name Dot2
  xpos -841
  ypos -259
 }
push $N9e40d780
 FilterErode {
  channels depth
  size {{parent.depth_erode_size}}
  name FilterErode_Depth
  xpos -576
  ypos -434
 }
push $N9e381630
 MergeExpression {
  inputs 2
  expr3 Az<=Bz?1:0
  name Holdoutmask
  xpos -576
  ypos -343
 }
 Switch {
  inputs 2
  which {{parent.method}}
  name Switch1
  xpos -576
  ypos -262
 }
 FilterErode {
  channels alpha
  size {{parent.erode.w} {parent.erode.h}}
  name FilterErode_Mask
  xpos -576
  ypos -173
 }
 Matrix {
  matrix {
      {1 2 1}
      {2 4 2}
      {1 2 1}
    }
  normalize true
  name Matrix1
  xpos -576
  ypos -137
  disable {{!parent.matrix_blur}}
 }
push $N9e381630
 ChannelMerge {
  inputs 2
  operation multiply
  name ChannelMerge6
  xpos -332
  ypos -143
 }
 Output {
  name Output1
  xpos -332
  ypos -32
 }
push $N9e3823f0
 Viewer {
  gain 0.96
  input_process false
  name Viewer1
  xpos -748
  ypos -314
 }
end_group
Premult {
 name Premult1
 xpos -146
 ypos 157
}
push $N1b0d0950
Merge2 {
 inputs 2
 name Merge1
 xpos -404
 ypos 208
}
Viewer {
 frame 1
 input_process false
 name Viewer1
 selected true
 xpos -404
 ypos 407
}
_______________________________________________
Nuke-users mailing list
[email protected], http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-users

Reply via email to