Delete based on color & normal?

   10724   1   1
User Avatar
Member
252 posts
Joined: 7月 2005
Offline
Hi all,

I have some geometry where I have an old normal saved into color (Cd) and the different current normal on the point (or prim). I want to delete points (prims preferably) based on a dot product of the color (treated as a vector) with it's normal. Any result with a negative dotproduct would be deleted.

Can I do this with a Delete SOP? I have tried some expressions with the “Normal” option and using a “point” expression to read the Point color from the previous SOP, but I can't get it to work. Should something like this be put in the “Rule” part of a Delete SOP rather than the “Normal” part?

It seems like the Delete SOP should work iteratively like this, and I am thinking my expression just isn't working. I have something like this:
point(“/obj/geo1/previousSOP”, $PT, “Cd”, 0) to get the red channel color from the current point at the last SOP. Not sure if this works in the delete SOP, or if I did something wrong there…

Thanks for any help.
Craig Hoffman
User Avatar
Member
268 posts
Joined: 7月 2005
Offline
Delete Sop should do the trick.. have the options set to ‘number/enable’ and ‘delete by expression’. In expression just add ‘if’ statement to your point expression

if (point(“/obj/geo1/previousSOP”, $PT, “Cd”, 0) <0,1,0)

For the dot product in your Cd
dot (
normalize(vector3 (point(“../point1”,$PT,“N”,0),point(“../point1”,$PT,“N”,1),point(“../point1”,$PT,“N”,2))) ,
normalize(vector3 (point(“../point2”,$PT,“N”,0), point(“../point2”,$PT,“N”,1), point(“../point2”,$PT,“N”,2)))
)

Hope that helps.
  • Quick Links