Shadow Catcher, Matte in Solaris for Karma XPU and MaterialX in Houdini




Shadow Catcher, Matte in Solaris for Karma XPU and MaterialX

shadow catcher using background plate

This workflow renders out one image containing alpha and shadow, with the options to adjust the brightness of the shadow.

settings up the scene and rendering

in /obj context add some test geo, a grid, light and cam go to /stage context add lots of scene import nodes for: geo, grid, cam, materials (and merge them) add dome light (or other lights) add background plate node primitives: /grid1 (select the grid) add karma render settings node (feed the backgroundplate) output picture: $HIP/render/test.exr resolution mode: manual resolution: 1024 1024 rendering engine: XPU image output -> AOVs (render vars) -> check import render vars from second input extra render vars -> name: holdout format: color3h data type: color3f source name: holdout;C.*[LO] source type: LPE add usd render rop node click on render to disk (use render scheduler to see progress)

compositing the image into a transparent one

go to /img context, add img network add file node, name it: comp file: $HIP/render/test.exr add 3 extract nodes, name them: extract image, extract shadow, extract alpha extract image node -> plane: C rename plane: C extract shadow node -> plane: holdout_shadows rename plane: C extract alpha node -> plane: A rename plane: C add color node, name it: shadow_brightness mask tab -> effect amount: 0.5 (adjust this later) image tab -> override size: ch("../comp/size1") ch("../comp/size1") (reference file node image size) add multiply node, feed shadowbrightness and extractshadow nodes add screen node, feed multiply and extractalpha nodes add extract node, name it: extractalpha2 (feed screen node) plane: C rename plane: A add add node feed _extract image node and extractalpha2 node add rop file output node output picture: $HIP/comp/test.png click render

node graph

file (comp) ┬ ┌─────────────────────┴──────────────────┬───────────────────┐ │ │ │ │ │ │ extractimage shadowbrightness extractshadow extractalpha ┬ ┬ ┬ ┬ │ │ │ │ │ └────────┬────────┘ │ │ multiply │ │ ┬ │ │ │ │ │ └──────────────┬─────────────┘ │ screen │ ┬ │ │ │ extractalpha2 │ ┬ │ │ └───────────────────────┬──────────────────────┘ add ┬ │ ropfileoutput (the mtlx ambient occlusion node currently only works with Karma CPU, and there is no mtlx shadow catcher material) see tips for: mtlx ambient occlusion karma (materialX)

src

https://www.youtube.com/watch?v=p5sEhWI2Iwc https://www.youtube.com/watch?v=3xmYbiuiXsI



Published: November, 2023