roarke80 Posted October 27, 2017 Share Posted October 27, 2017 Hi, sorry if this has been asked before, but I'm a beginner and am not even sure how to begin searching. I'm trying to select the points on an object that are at a greater angle away from camera. Basically it would be as though I applied a Fresnel in C4D or a facing ratio shader in Arnold, and then deleted away all the black points which leaves me with the outer rim of the object. If I can control it by somehow shining a light on it to determine where the camera is that would be great. Any tips would be greatly appreciated, many thanks! Quote Link to comment Share on other sites More sharing options...
konstantin magnus Posted October 28, 2017 Share Posted October 28, 2017 You can compare the angle of the camera direction towards the points against the surface normals with a dot product. float thresh = chf('angle_threshold'); vector cam_pos = normalize( chv('camera_position') ); vector dir = normalize(@P - cam_pos); float angle = abs( dot(cam_pos, @N) ); if(angle > thresh) removepoint(0, @ptnum); camera_angle_delete.hipnc 1 Quote Link to comment Share on other sites More sharing options...
stickman Posted October 28, 2017 Share Posted October 28, 2017 Cool stuff, Konstantin! If you wanted to just make a group of those points, what would that last line be? Quote Link to comment Share on other sites More sharing options...
acey195 Posted October 28, 2017 Share Posted October 28, 2017 1 hour ago, stickman said: Cool stuff, Konstantin! If you wanted to just make a group of those points, what would that last line be? @group_delPoints = (angle > thresh); //or alternatively (needed if want to assign the group to points other than the ones currently ran over): if(angle > thresh) setpointgroup(0, "delPoints", @ptnum, 1); //or again optimized: setpointgroup(0, "delPoints", @ptnum, angle > thresh); 2 Quote Link to comment Share on other sites More sharing options...
konstantin magnus Posted October 28, 2017 Share Posted October 28, 2017 (edited) With optransform(), cracktransform() you can access a nice object chooser that reads out the camera position for you. I also corrected the code which results in this: float thresh = chf('threshold'); matrix cam_matrix = optransform(chs("camera")); vector cam_pos = cracktransform(0, 0, 0, {0,0,0}, cam_matrix); vector dir = normalize(cam_pos - @P); float angle = abs( dot(dir, @N) ); setpointgroup(0, "rim", @ptnum, angle > thresh, "set"); camera_angle_delete.hipnc Edited October 28, 2017 by konstantin magnus added example file 2 Quote Link to comment Share on other sites More sharing options...
roarke80 Posted October 28, 2017 Author Share Posted October 28, 2017 Wow this works beautifully, thank you so much for your help! 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.