CinnamonMetal Posted June 14, 2018 Share Posted June 14, 2018 (edited) I'm using a forEach SOP to loop over all primitives but how do I access only the primitives which are facing the +Y axis in a wrangler ? How do you access an iteration number of a forEach SOP ? Edited June 14, 2018 by CinnamonMetal Quote Link to comment Share on other sites More sharing options...
toadstorm Posted June 14, 2018 Share Posted June 14, 2018 A.) don't use a for-each to loop over all primitives, use a primitive wrangle. they inherently loop over all primitives. B.) assuming you have vertex or point normals already, before the wrangle, promote N to a primitive attribute. C.) in your prim wrangle, compute dot(@N, {0,1,0}). something like this: float d = dot(@N, {0,1,0}); float threshold = 0.75; // closer to 1.0 = more sensitive if(dot > ch("threshold")) { // do whatever } Quote Link to comment Share on other sites More sharing options...
CinnamonMetal Posted June 14, 2018 Author Share Posted June 14, 2018 Great, but; I know but for sake of this question, ignore using a primitive wrangler for looping and say you were forced to use a forEach SOP, how would you do what I mentioned in my original question ? Quote Link to comment Share on other sites More sharing options...
toadstorm Posted June 14, 2018 Share Posted June 14, 2018 The code would be exactly the same, it would just run a lot slower. Primitive Wrangles are inherently running for-each. This has been brought up in past threads. 1 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.