Last active
May 24, 2019 01:05
-
-
Save ayoburgess/cbf4fbb812fe91d480a1f7c0c3270459 to your computer and use it in GitHub Desktop.
Houdini VEX - Tag points outside of camera frustum
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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