Obtaining LOP instancer 'invisibleIds' attribute within SOPs

   220   2   1
User Avatar
Member
3 posts
Joined: Oct. 2018
Offline
Hi,

Given a instancer, created in LOPs that already has a 'invisibleIds' attribute, how do i grab this attribute in SOPs.

Scenario im trying to complete here is, i have a instancer (say from another dept, so written out to a usd file) that has been 'frustrum culled', the culled points being stored in the invisibleIds. I want to now do some occlusion culling to cull any instances that cant be seen via the camera. So I wanted to LOP import into SOPs, run a wrangle on it to figure out any intersections. However im really struggling to find out if that point is already invisible, as there seems to be no good way of getting the invisibleIds attribute in SOPs?
User Avatar
Staff
407 posts
Joined: Feb. 2008
Offline
When you LOP Import the instancer prim and unpack to polygons, it'll bring in a packed USD for each instance with a "usdvisibility" string attribute set to "invisible" for all invisible instances.

In SOPs, you can use all the usd_* VEX functions to get any attrib/primvar etc from any prim on the stage.

Here's an example that shows both the usdvisibility attribute being accessible in a SOP Modify LOP and a sopnet, and another example showing how you can get the instancer attributes onto the instances in SOPs.

With regards to invisibleIds, keep in mind that if your instances have Ids you'll need to first get the Id attribute per instance and check if it can be found in the invisibleIds array as opposed to simply using the instance index as I am doing in the example.

Attachments:
USD_Attribs_in_SOPs.hip (174.2 KB)

User Avatar
Member
3 posts
Joined: Oct. 2018
Offline
Oh great, let me check this out, from first looks this should solve my issues!
  • Quick Links