For SOPs and normal Houdini land the toNDC() VEX function is perfect - take the @P to the NDC space of the given camera and every point outside of the 0-1 range can be deleted. This function doesn't work (yet) for USD Cams.
Is there a way to see into the toNDC() function, what it's technically doing? I looked into the Houdini folders to maybe find the description of this function but no success.
Then I tried to wrap my head around to manually code a way to get the Position vectors of the instances to the ndc space of the given USD cam. Tried the projection() vex function, other ways to build the projection matrix I found online, tried this in the post https://www.sidefx.com/forum/topic/16953/ [www.sidefx.com] but nothing brings the same result as the toNDC() function.
My dirty solution was to create an obj network, LOPimport the USD cam to normal Houdini land and use that cam for the toNDC function. Not super elegant AND that would only work for static cams (with a moving cam you might see shadows popping in/out of elements outside the cam view). With the usd_attrib functions you can also get time sampled values, so culling instances never visible in the full range would be possible.
Thanks in advance!
![](/static/djangobb_forum/img/smilies/smile.png)