Jump to content
squardis

once apon a time far far away....clip points by camera view

Recommended Posts

Hi,

Once Upon a time far far back in the old houdini, I saw a example of someone clipping all the point that are not in the viewport.

Now I know it is possible with volumes. but I need a node / way that does that on points (for example Instances)

Does anyone know?

THNX :)

 

Share this post


Link to post
Share on other sites

With Volume SOP you can create Volume based on Camera View. Then you can use Gourp SOP with Bounding Volume to isolate points inside Camera Frustum.

Share this post


Link to post
Share on other sites

in an attribWrangle:
 

vector _ndc = toNDC("/obj/cam1", @P);

float _errorx = ch("errorx");
float _errory = ch("errory");
float _errorz = ch("errorz");

if ((_ndc[0] < 0 - _errorx) || (_ndc[0] > 1 + _errorx))   removepoint(geoself(), @ptnum);
if ((_ndc[1] < 0 - _errory) || (_ndc[1] > 1 + _errory))   removepoint(geoself(), @ptnum);
if ((_ndc[2] > 0 + _errorz))   removepoint(geoself(), @ptnum);

update the path to your camera, then set your error margins accordingly

  • Like 5
  • Thanks 1

Share this post


Link to post
Share on other sites

I cant try it at the moment rightnow but if you scatter point I think it breaks becouse there is no volume
am I right?

 

Share this post


Link to post
Share on other sites

you're not. the volume is created out of camera frustrum and used as a mask for grouping points.

  • Like 1

Share this post


Link to post
Share on other sites
38 minutes ago, iamyog said:

in an attribWrangle:
 


vector _ndc = toNDC("/obj/cam1", @P);

float _errorx = ch("errorx");
float _errory = ch("errory");
float _errorz = ch("errorz");

if ((_ndc[0] < 0 - _errorx) || (_ndc[0] > 1 + _errorx))   removepoint(geoself(), @ptnum);
if ((_ndc[1] < 0 - _errory) || (_ndc[1] > 1 + _errory))   removepoint(geoself(), @ptnum);
if ((_ndc[2] > 0 + _errorz))   removepoint(geoself(), @ptnum);

update the path to your camera, then set your error margins accordingly

Is this a quicker approche in multithreading than the rest?
And where to put this? ( wrangles are getting better and better, but still learning)

Share this post


Link to post
Share on other sites
6 minutes ago, davpe said:

you're not. the volume is created out of camera frustrum and used as a mask for grouping points.

Thanx!!! It works!!! 
straighth from my mobile and teamviewer :)  and ofcourcse a big thnx to you guys!!!

 

Share this post


Link to post
Share on other sites

you're welcome. wrangle solution seems to be more elegant though. and will definitely perform faster with lots of geometry.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×