Thursday, 8 October 2026

screen space depth, ndc, camera space, flattening stuff

 

Pinched this from Tomas on the houdini forums.

This is useful for moving stuff in and out of camera space, but maintaining the "2d" flat appearance of an object.

Plug this into a point wrangle- 


string cam = "/obj/cam1";
@P = toNDC(cam, @P); // to ndc space
@P.z *= 0;  // flatten
@P.z -= chf("depth"); // set depth
@P = fromNDC(cam, @P); // if you need bring back in front of cam


i've changed the set depth to a float slider to be a bit more interactive, you could just put a hard value in.

the fromNDC(cam,@P) part is the line that brings your object back in front of your camera...otherwise toNDC just exists somewhere near the origin. 

the @P.z*=0; to flatten is entirely optional... you can use this script to move things around in "camera z" 

rendering with karma/solaris in a more "normal way"

 Just a way to work as if you have a render view, instead of in the viewport.

 In Stage, make a Clone Control Panel tab (where your parameters are)


click the Clones with a arrow button, make a new Local one, select Karma CPU or GPU..
Drag your karma render settings node onto the "Node".
Now you can toggle a render on and off in a Render Gallery window & it will save a snapshot each time (might be good or bad....).