Jump to content

Compute normal


Rudinie

Recommended Posts

A very common method to calculate a pointnormal from a moving object (i think) is timeshifting the point by $F-1 frame and then use a point sop to add a normal by subtracting the positions like this: $TX-$TX2, $TY-$TY2, $TZ-$TZ2

This works like a charm on moving geometry. But the moment the geometry gets to a full stop, the values of $TX and $TX2 etc are exactly the same resulting in a 0,0,0 normal.

Other then using a python script i can't figure out a way to store the normal in memory for a current frame to retrieve it on the next frame.

Does anyone have a smart workaround for this?

Link to comment
Share on other sites

by substracting point position from previous frame you can get velocity vector but not point normal. Geometry point normal have nothing to do with movement of object.

Facet with recompute point normals should help you.

Edited by tmdag
  • Like 2
Link to comment
Share on other sites

by substracting point position from previous frame you can get velocity vector but not point normal. Geometry point normal have nothing to do with movement of object.

Thanks for replying.

I am actually using the velocity-vector to get a point normal that's pointing in the direction of travel. I assumed this was clear but i realize it wasn't, sorry for that.

In the mean time i found a workaround, by adding the point and the normal to the center of the moving object and object merge that point in, rather than adding the point in the separate object.

So i guess my question came down to: how do i extract the orientation of an object that i got merged in.

Link to comment
Share on other sites

By subtracting velocities data You also won't get normal. Normals have totally -nothing- to do with movement of the object.

What are you trying to do ?

Well, sorry to be stubborn but yes, i AM using the point normal to orient the object in the direction of travel. :-)

Of course you are right that i'm calculating a velocity vector and i am "abusing" it as a point-normal to orient the object that i copy on to the point. I've seen this done in several tutorials, most recently Jonah Hall's tutorial in the creative development series on d-t.

Link to comment
Share on other sites

Hi Rudinie,

See attachment. If you need an euler rotation, use Extract Transform VOP to get angles from rotation matrix.

Thanks SYmek, Very nice way of extracting orientation in your file.

I didn't know about polyframe sop. Seems very useful.

However, I fail to understand how polyframe is calculating the tangentu vector.

I mean, If set to Style : First edge.

It gives tangentu (vector a) towards (p2,v3) from point ( p0,v0) in the attached image.

I figured at least this calculation is not based on the point numbers. I tried sorting points randomly to get the same result.

My next guess was that it could be based on vertex numbers.

Vector from ( vert0 -> vert1) would make sense but resulting tangentu seems from (vert0 -> vert 3).

So what does "First Edge" mean in this context?, And How is tangentu calculated ?

Thanks,

post-6162-132229028519_thumb.jpg

Link to comment
Share on other sites

Indeed, little mysterious. To me it looks like tangentu goes with the last edge, i.e. reversed vertex order, i.e. from current to previous vertex. If you take a circle object, it's vertices are reversed-ordered to points, so you can see how tangents go in opposite. With grid though, points seem to obey ordering from alternative triangles, so this does this strange effect. With box or user-made polygon they seem to keep the pattern (current->previous vertex - with special case first ->last).

Interesting part is that if PolyFrame relies on vertex ordering, how it deals with shared vertices. It seems to be taking the first polygon the point is sharing vertices with for a tangentu, then normals are averaged for all, then - if "Make Frame Orthogonal" is turned on - tangent is crossed with normal and tangentv, to make it orthogonal to those, not those make orthogonal to it. Interesting!

Link to comment
Share on other sites

A very common method to calculate a pointnormal from a moving object (i think) is timeshifting the point by $F-1 frame and then use a point sop to add a normal by subtracting the positions like this: $TX-$TX2, $TY-$TY2, $TZ-$TZ2

This works like a charm on moving geometry. But the moment the geometry gets to a full stop, the values of $TX and $TX2 etc are exactly the same resulting in a 0,0,0 normal.

You're computing velocity, so I think it's correct in that sense to have a 0,0,0 value for still (non-moving) geometry. The question is how you plan on using those values, and for what purpose.

Other then using a python script i can't figure out a way to store the normal in memory for a current frame to retrieve it on the next frame.

What about using a SOP Solver DOP to process the same geometry from frame to frame.

Link to comment
Share on other sites

Hi Rudinie,

See attachment. If you need an euler rotation, use Extract Transform VOP to get angles from rotation matrix.

Hi SYmek,

thanks for the example. Like vectorblur i didn't know the polyframe sop yet.

Looks like a way that can be used in a lot of different situations.

Link to comment
Share on other sites

  • 2 months later...

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...