Nik S Posted July 31, 2012 Share Posted July 31, 2012 Hey guys! So I am doing a bunch of particle sims and want to kill the particles outside of the camera frustum's bounds. I could do this no problem if I could create geo matching the camera frust. Thing is, I'm not exactly sure how to create such geo. What comes to mind is matching a grid to the camera "far" attr then drawing lines from the camera origin to those 4 points of the grid then using a Skin Sop... Has anyone done a tool like this in the past? Mind sharing your methods? Thank you!! =) - Nik Quote Link to comment Share on other sites More sharing options...
Klockworks Posted July 31, 2012 Share Posted July 31, 2012 Look into the toNDC node in VOPs. You pass it a camera and it passes back a vector representing where the input you gave it is in camera space. So it goes from world(x,y,z) to (horiz 0-1, vert 0-1, depth). In 12 though it has a bit of issues with multithreading so make sure you set your vop node to no threading unless you want it to randomly error out. Quote Link to comment Share on other sites More sharing options...
ryew Posted July 31, 2012 Share Posted July 31, 2012 You can try using the Volume SOP to group based upon the camera frustrum and z-depth you've set there (or linked to the camera attribute) as well. See the simple hack/example attached cameraGrouping.hip 4 Quote Link to comment Share on other sites More sharing options...
Nik S Posted July 31, 2012 Author Share Posted July 31, 2012 You can try using the Volume SOP to group based upon the camera frustrum and z-depth you've set there (or linked to the camera attribute) as well. See the simple hack/example attached Awesome! Exactly what I needed. Cheers. Quote Link to comment Share on other sites More sharing options...
jkunz07 Posted July 31, 2012 Share Posted July 31, 2012 Hey guys! So I am doing a bunch of particle sims and want to kill the particles outside of the camera frustum's bounds. I could do this no problem if I could create geo matching the camera frust. Thing is, I'm not exactly sure how to create such geo. What comes to mind is matching a grid to the camera "far" attr then drawing lines from the camera origin to those 4 points of the grid then using a Skin Sop... Has anyone done a tool like this in the past? Mind sharing your methods? Thank you!! =) - Nik camera_sop_vis_toodforce.hip Quote Link to comment Share on other sites More sharing options...
zarti Posted July 31, 2012 Share Posted July 31, 2012 joining the party ; a cheap with few handy options .. ( H11-file ) -- camFrust_00.hipnc .cheers Quote Link to comment Share on other sites More sharing options...
Nik S Posted July 31, 2012 Author Share Posted July 31, 2012 (edited) I knew the community wouldn't let me down! Ended up going with the Volume Sop piped into a Volume Bound to get geometry which I use for some cool things (emission plane etc). Tip: Add a Clip Sop in there to get a groundplane for your frustum. Edited July 31, 2012 by Nik S Quote Link to comment Share on other sites More sharing options...
altbighead Posted July 31, 2012 Share Posted July 31, 2012 I knew the community wouldn't let me down! Ended up going with the Volume Sop piped into a Volume Bound to get geometry which I use for some cool things (emission plane etc). Tip: Add a Clip Sop in there to get a groundplane for your frustum. I can't live without Frustum. Another cool trick i use is trail sop the frustum and you can get the bbox of the animated camera coverage.good emitter for weather effect where you are emitting only where you need . 2 Quote Link to comment Share on other sites More sharing options...
mikelafave Posted August 1, 2012 Share Posted August 1, 2012 kind of "old school" approach (using hscript expressions, etc), but 1 fun tinkering project is to make your own "frustum" geo object, wire your camera into it, start with a "box" SOP, UVtexture map it from the perspective of that same camera, then stretch it using that mapping in a "point" SOP using expressions referencing the camera channels like : opparm /obj/frustum/point1/mapu ( '$MAPU + ch(opinputpath("../..",0)+"/winx")' ) opparm /obj/frustum/point1/tx ('($TX+ch(opinputpath("../..",0)+"/winx"))*(0.5/abs(ch(mapu)-0.5))') ...and so on (mapv & winy for ty, near & far for tz, etc) This is not a complete example, but you'll make it your own! Quote Link to comment Share on other sites More sharing options...
graham Posted August 1, 2012 Share Posted August 1, 2012 There's also these: Camera frustum http://houdinitoolbox.com/houdini.php?asset=60 Wire the above into something like this to kill geometry outside the frustum. http://houdinitoolbox.com/houdini.php?asset=61 Quote Link to comment Share on other sites More sharing options...
limeforce Posted August 22, 2018 Share Posted August 22, 2018 (edited) On 8/1/2012 at 12:29 AM, Nik S said: I knew the community wouldn't let me down! Ended up going with the Volume Sop piped into a Volume Bound to get geometry which I use for some cool things (emission plane etc). Needed to group points inside camera frustum in SOPs (to remove instances not seen by camera), googled, ended up here. Found that Volume SOP ('From Camera') ---> Volume Bound SOP is an easy way to get a lightweight polygon version of the camera frustum. Used it as a bounding object (Peak SOP to enlarge a bit to include nearby instances for bounce light) in a Group SOP and voila, job done. TLDR: +1 for Volume SOP ---> Volume Bound Edited August 22, 2018 by limeforce 1 Quote Link to comment Share on other sites More sharing options...
mikelafave Posted November 26, 2018 Share Posted November 26, 2018 agreed! : +1 for Volume SOP ---> Volume Bound ... seems the most complete And the simplest solution! can even be made to react to "cam/winx" (for stereo convergence offset, etc) unlike the Persistent Camera Frustum Handle described in https://www.sidefx.com/forum/topic/38528/ though I'll always appreciate how "UV Texture" SOP's 'Perspective From Camera' "@uv.z" = Depth from Camera (which is Also useful for particle Culling...) 'Perspective From Camera' UVs are what I used to build my frustum geo in the past (for example) ... ml_cam_frustum_v01.hipnc Quote Link to comment Share on other sites More sharing options...
jonidunno Posted January 11, 2019 Share Posted January 11, 2019 In a wrangle write: v@ndcP= toNDC(chs("cam"),v@P); float padding = chf("padding"); float nearclip = chf("nearclip"); if(v@ndcP.x > (1 + padding) || v@ndcP.x < (0 - padding) || v@ndcP.y > (1 + padding) || v@ndcpos12321.y < (0 - padding) || -v@ndcP.z < nearclip){ removepoint(0,@ptnum); } click on the spare parameters and add the camera you wanna add. 1 3 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.