Jump to content
CinnamonMetal

Access Primitives in Y axis ?

Recommended Posts

Posted (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 by CinnamonMetal

Share this post


Link to post
Share on other sites

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

}

 

Share this post


Link to post
Share on other sites

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 ? :)

Share this post


Link to post
Share on other sites

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.

  • Thanks 1

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

×