Frustrum cull inside Solaris

   3362   7   1
User Avatar
Member
306 posts
Joined: July 2005
Offline
I'm bringing in a setup I've built in obj/sop land to attempt multi-shot work in Solaris.

There's lots of objects and lights instanced. I've got a frustrum cull HDA that works through the UV project method, so requires pointing to an actual camera objects. This works great in the old world.

In the new world - I want to discard any references to the original scene so I can read in USD cameras and do the cull sops in the instancer LOP. But how do I create a camera object from the camera primitive?

Am I going about this wrong? Suggestions?

In the mean time I'm just ensuring there's the original camera as an object in the hip file I can point to.
“First things first – but not necessarily in that order”
– The Doctor
User Avatar
Member
12428 posts
Joined: July 2005
Offline
Hi Rangi!

Have you seen the %bound autocollection? https://www.sidefx.com/docs/houdini/solaris/pattern.html [www.sidefx.com]

I don't think there is a convenient node built on top of it yet, but it's not too hard to do.
Jason Iversen, Technology Supervisor & FX Pipeline/R+D Lead @ Weta FX
also, http://www.odforce.net [www.odforce.net]
User Avatar
Member
306 posts
Joined: July 2005
Offline
Hey Jason!

Yeah, thanks for pointing that out. Looks like it should do the trick. Just doesn't work for me. I'm putting it into a prune lop. Testing with a simple bbox it's pruning the instances fine.

If I use
%bound(min = [-2.5, -2.5, -2.5], max = [2.5, 2.5, 2.5])
it doesn't work. And using
%bounds(/cameras/camera1)
doesn't work either.

So not sure if bug or I'm just doing it wrong because LOPs are new to me.

Submitting a bug because if I point it to a camera that doesn't exist I get a seg fault.

h19.0.491
Edited by rangi - Nov. 29, 2021 03:21:46
“First things first – but not necessarily in that order”
– The Doctor
User Avatar
Member
7737 posts
Joined: Sept. 2011
Offline
rangi
Yeah, thanks for pointing that out. Looks like it should do the trick. Just doesn't work for me. I'm putting it into a prune lop. Testing with a simple bbox it's pruning the instances fine.

It's not a bug, collections cannot target instances. The bound collection can only intersect with the bounding box containing all of the instances.
User Avatar
Staff
356 posts
Joined: Feb. 2008
Offline
Here's a quick hip file showing how you can delete point instances by camera frustrum.

Dive inside the modify point instances LOP for details on how you can bring in the USD camera and reference it in a wrangle to delete unwanted instances.

Or simply do the same thing upfront in the instancer LOP before even creating the instances.

To answer your initial question, to create a camera from a USD camera prim, you need to use the LOP Import Camera node in an object context - from there you can reference it as you would any normal camera.

Attachments:
DeleteByUSDCameraFrustrum.hip (369.1 KB)

User Avatar
Member
306 posts
Joined: July 2005
Offline
jsmack
It's not a bug, collections cannot target instances. The bound collection can only intersect with the bounding box containing all of the instances.

OK - cool. I've got lots to learn about USD / Solaris still! Thanks.

npetit
Here's a quick hip file showing how you can delete point instances by camera frustrum.

Sweet as... so the Lop Import Camera is exactly what I was looking for. Going to adopt your toNDC wrangle over my outdate UV texture sop too.


My problem is solved. Just left academically wondering now how one would go about this if you'd already made the instances and you wanted to prune them?
“First things first – but not necessarily in that order”
– The Doctor
User Avatar
Member
306 posts
Joined: July 2005
Offline
rangi
Just left academically wondering now how one would go about this if you'd already made the instances and you wanted to prune them?

Ah - I see you actually answered that in the hip file. Delete points inside "Modify Point Instances" LOP... Great!
“First things first – but not necessarily in that order”
– The Doctor
User Avatar
Member
160 posts
Joined: Jan. 2019
Offline
npetit
Here's a quick hip file showing how you can delete point instances by camera frustrum.

Thanks for this file, I've just been playing with it. I would avoid simply deleting the points if animating the camera over time. As it appears to be writing the full point instances arrays for every frame, and I've had issues with instances strangely interpolating over time..

Instead use a SOP_visibility to hide the culled points.

Usd then writes a tiny file, only containing an array for invisible ids.

npetit, thanks again for the setup.
  • Quick Links