Occlusion probe

   859   1   1
User Avatar
Member
207 posts
Joined: 11月 2015
Offline
Hiyo;

I have a Solaris setup in which I'm using a Wrangle to programmatically position and aim a camera. It's often the case, with my scene, where the camera chooses to place itself in such a way that its view to the subject is occluded (either it ends up inside another object, or another object is in the way). So, I'd like to write a bit of logic that tests to see if the view to the subject is clear, and if not, do some repositioning until the view is clear.

I'm struggling to envision how to do this; I see there are "trace", "rayhittest", and "intersect" functions in VEX, though none of these seem like they're quite what I need; I think I want to fire a ray away from the camera, see if it hits something other than the subject (how do I know the hit geometry is my subject in Solaris? Maybe I ask for a prim name or something?), then choose further logic from there. If my wrangle is running over my camera prim, how do I "import" or otherwise specify geometry to trace against in VEX?

I'm not opposed to moving to python if it's easier, it just happens that my existing code is in vex, so if it's possible I'm happy to stay there. And I'd like to avoid a whole separate node or network of nodes, if it's possible for me to do this within the same code block that's doing the positioning.

Anyway, I'd love to hear some ideas as to how to approach this.

Thanks!
User Avatar
Member
7802 posts
Joined: 9月 2011
Offline
vex functions that refer to geometry can only refer to SOP geometry. you would have to import the geometry into a sopnetwork and convert from usd packed geometry to polygons.

I don't think python would be any help unless you plan on rendering an image to temp or something and using machine vision to parse the image.
  • Quick Links