Skip to content

Instantly share code, notes, and snippets.

@ayoburgess
Last active May 24, 2019 01:05
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ayoburgess/cbf4fbb812fe91d480a1f7c0c3270459 to your computer and use it in GitHub Desktop.
Save ayoburgess/cbf4fbb812fe91d480a1f7c0c3270459 to your computer and use it in GitHub Desktop.
Houdini VEX - Tag points outside of camera frustum
string camera = chs("camera");
vector screen_pos = toNDC(camera, @P);
float left_padding = chf("left_padding");
float right_padding = chf("right_padding");
float top_padding = chf("top_padding");
float bottom_padding = chf("bottom_padding");
f@outside = 0;
int outside_left = (screen_pos.x < (0 - left_padding));
int outside_right = (screen_pos.x > (1 + right_padding));
int outside_top = (screen_pos.y < (0 - top_padding));
int outside_bottom = (screen_pos.y > (1 + bottom_padding));
if (outside_left || outside_right || outside_top || outside_bottom) {
f@outside = 1;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment