Changing Point Normals

How do I change the orientation of the normals so they point in the X/Y direction? I like to be able to apply this technique to any image file so I can pass it through a Trace SOP > Particle SOP combo to make particles emit away from the outline.

Capture2.png

with pointSOP if you chood ‘add normal’ and instead of the normal write the point position
me.inputPoint.x
me.inputPoint.y
and 0 for z

if your object is centered on 0,0,0 the normals will not really be perpendicular to that line section but at least they will point outward on x and y!
Then to ‘normalize’ your normals use a facedSOP and click ‘make normals unit length’

Not sure what the right way would be.
Maybe you could try extruding the shape to have the sides, dividing the shape in z, computing normals with attributeCreate and then deleting the front and back faces with a delete to keep online the ‘middle’ points with the good normals. But that seems hacky :stuck_out_tongue:

You might be able to calculate it based on a cross product between the (vertex and it’s neighbor) and the vector coming out of the screen

I wanted to do the same thing, did some googling, and hit this post, which gave me some inspiration combined with a tutorial I’d recently watched. The short of it is you can use one of the Slope operators and massage the data that comes out of it to get the normal, then roll it back into a SOP, like so:

I’ve got a write up and a toe file over on github: GitHub - codrakai/touchdesigner-2d-normals-example: Demonstration of how to generate outward pointing normals for a primitive with a set of points in the same z plane

2 Likes

Wow that’s sick, thanks for sharing your work!

1 Like