Rendering with Karma XPU (materialX) in Houdini

Rendering with Karma XPU (materialX)

XPU requires materialX shaders for rendering, instead of VEX based shaders (i.e. principled shader) create a new project in /obj context add some geo, lights

creating a simple material

go to /mat context add Mtlx Standard Surface node (it's similar to redshift's rs_material or principled shader) add Mtlx Image node and select a texture image here (it's similar to redshift's rs_texture node) feed it into Base-color of Mtlx Standard Surface node (for more detailed materials see: karma materials with normal and displacement maps (materialX))

assigning materials

assign the new materials by adding material nodes inside the geo objects in /obj

adding objects to stage (solaris)

go to /stage context (right side, networkview) add scene import (all) node filer: geometry objects add scene import (materials) node then add merge node and merge them

or use:

add sceneimport(all) node objects: *

adding camera to stage (solaris)

add camera node focal length: 180 aspect ratio: 1 x 1 add merge node merge the +camera nodes with previous nodes

adding lights to stage (solaris)

add environment light texture: set HDR map here add area lights (texture: set softbox texture here) add merge node merge the light nodes with previous nodes

enable disable light for specific object

after adding lights on stage add light linker node drag a light into the rules field in the middle drag geo from the right into light/shadow fields to include or exclude geo for each light

quickly toggle or adjust lights

add light mixer node select lights and drag over into right field (select tab sliders)

adding IES lights

add spot light spot light options -> IES MAP

adding lights with custom shapes

in affinity designer, create the custom shape as a black mask/overlay, export as .exr add area light and select this texture

rendering the final image with karma

go to /stage context add karma node this adds karma render settings and usdrender-rop nodes set rendering engine: XPU Engine click Render to Mplay

adding dept of field

/obj -> camera -> sampling tab set very low f/stop: 0.1 add null node and name it focusnode /obj -> camera -> sampling tab -> focus field vlength(vtorigin(".","../focusnode")) karmarendersettings -> rendering tab -> camera effects tab enable depth of field

to preview DOF (depth of field):

change left scene view window (top dropdown) from obj to stage, click the pin icon to make it sticky then set values on camera (to avoid camera edit node in stage: go back to geo context and adjust cam here)

increasing samples to remove noise

path traced samples: 512 or more rendering tab -> sampling tab and limits tab -> adjust here image output tab -> filter tab -> denoiser: NVIDIA remember to increase refraction limits if refractive materials like glass or water were used, or surface will be black: karma render settings: rendering -> limits -> refraction limit: 6

render view

add new tab above 3d viewport -> viewers -> context view set drowndown to stage (set to karmaXPU)

updating textures in karma viewport

(if this doesn't work: Render -> Update Textures) switch to Karma CPU Persp, then back to Karma XPU Persp delete the .rat files (in textures folder) top menu dropdown -> reload current desktop open/close houdini

set render preview from progressive to bucket (for karma CPU)

advanced tab -> buckets and caching -> image mode: bucket

see render progress, render scheduler

on top of network view -> click new pane tab type: render scheduler

rendering multiple takes in karma

create the takes with custom parameters, switches, settings etc. go to /out context add USD render node render with take: SET-TAKE-HERE render delegate: XPU LOP path: /stage/SET-KARMA-RENDER-SETTINGS-NODE-HERE (select the karma settings node) output tab -> check wait for render to complete add batch node below copy usdrender node and batch node several times and set the different takes add a merge node below and feed all the batch nodes click render

to quickly reduce resolution

select all usdrender nodes override resolution: percentage of resolution resolution scale: 20

compositing, converting the exr file

go to /img context add imgage network and dive inside add File node and load the just rendered .exr add Rop File Output node Valid Frame Range: Render Current Frame Output Picture: $HIP/comp/final.png

converting multiple exr files at once

just add a top net (in img context) go inside and add a file pattern node Pattern: $HIP/render/* below add a rop composite node inside do the usual processing Output: $HIP/comp/`@filename`.png


Published: January, 2024