Control cage for normals

   7720   9   1
User Avatar
Member
17 posts
Joined:
Offline
Hello! Fresh apprentice user here.

Two simple(?) questions:
1.
I have a curve (polygon type), the curve has 2 points. Number 0 and 1. How can I set point 0's normal to follow point 1's location ? I've been trying to build all kinds of look at systems with very little functionality.

2.
I'd like to copy this curve (with Copy SOP) to points of a polygon mesh and transfer the normal data (generated in the 1st question) from point 0 to polygon mesh point it has been copied to (maybe with attribute transfer?).

So I'd like to use these copied curves as devices to manipulate polygon mesh normals. I know there's the comb normals tool but this could form a good foundation for various types of control cages. I know VEX could deal this all but I'm a bit too unfamiliar with it to go down that road yet.

Thanks!
-ilkka
User Avatar
Member
311 posts
Joined: July 2005
Offline
Welcome to the Forum, Fresh Apprentice User There.

Hope you come to enjoy it for the fun factory it is.

Anyway, you can use a point SOP and a point expression to take the normalised difference between point 0 and 1 to give you the normal.
Attribute transfer should do the rest, or again you could use the point SOP and an expression to reference the points from the copy SOP.

Jerry
User Avatar
Member
17 posts
Joined:
Offline
jesta
Anyway, you can use a point SOP and a point expression to take the normalised difference between point 0 and 1 to give you the normal.
Jerry

Thank you for answering!

Here's what I inserted to Add Normal x,y,z fields:

normalize( point(“obj/geo1/curve1”,1,“P”,0)-point(“obj/geo1/curve1”,0,“P”,0))

normalize( point(“obj/geo1/curve1”,1,“P”,1)-point(“obj/geo1/curve1”,0,“P”,1))

normalize( point(“obj/geo1/curve1”,1,“P”,2)-point(“obj/geo1/curve1”,0,“P”,2))

The normal of point 0 still seems to be perpendicular to curves direction instead of looking at point 1. I'm sure this is all because of my puny knowledge of expression handling and math. What would be the proper technique for extracting the transformational difference and normalizing it ? I also suppose telling point 0 that the data is for him couldn't hurt..or is it necessary in this situation ?

-The Fresh
User Avatar
Member
311 posts
Joined: July 2005
Offline
maybe switch the points around in the expression. It always takes me a couple of goes to get the order right
User Avatar
Member
557 posts
Joined: July 2005
Offline
The normal of point 0 still seems to be perpendicular to curves direction instead of looking at point 1.

First of all, you can't normalize a single value, which is what you are doing. You have to normalize a vector. Second, it looks like you are using “p” in your expression, when it should be “P” (upper case) (though I may be wrong - it's hard to tell from the font).

One really easy way to do this is to simply do the subtraction in the Normal parameter of a point sop, eg
point(“../somesop”, $PT, “P”, 0) - point(“../someothersop”, $PT, “P”, 0)
in the X parameter, and similarly for Y and Z

Then follow this up with a facet sop, and just check the “Make Normals Unit Length” box.

I've attached a simple example.

Attachments:
normalizeDistance.hip (36.0 KB)

User Avatar
Member
17 posts
Joined:
Offline
Thank you guys. I have it working now.

The next problem is that every transformation tool (to edit these guide curve points), when inserted after the Point SOP, seem to reset my beautiful normals back to the square one. Should I add some sort of an point expression AFTER I copy and edit the curves to maintain point expressions done earlier in the graph ?

Like this:

(Curve)->(Point with the expression)->(Facet)->(Copy)->(Edit)->(Another point with expression ?)


Graig: The “P” is upper case For some reason I couldn't open your example scene. “Bad node type found: rman in/out” is the error message with a long list of unrecognized parameters.
User Avatar
Member
4262 posts
Joined: July 2005
Offline
Hazoc
Thank you guys. I have it working now.

The next problem is that every transformation tool (to edit these guide curve points),

There is a toggle on the Transform SOP that says “Recompute Point Normals”. Its on by default. You should turn it off if you want to keep your normals.
if(coffees<2,round(float),float)
User Avatar
Member
17 posts
Joined:
Offline
Wolfwood
There is a toggle on the Transform SOP that says “Recompute Point Normals”. Its on by default. You should turn it off if you want to keep your normals.

This would be logical and I've tried it but still something's wrong. I've attached my project for deeper debugging in case someone has time to give a quick glance at it. The meaning of each operator can be read from their comment tab. Transforming node should be placed between the copy1 and the first AttribTransfer node. Or is there a better way ?

http://www.lw-fin.org/gallery/hazok/karvaa2.zip [lw-fin.org]
User Avatar
Member
311 posts
Joined: July 2005
Offline
you almost had it. the trick is to compute the normals after the deformations.
I had a look at your .hip and tweaked it a bit to work. leave the display flags as they are and fiddle with the edit SOP. you may need to unlock it.

Jerry

Attachments:
karvaa2.zip (26.3 KB)

User Avatar
Member
17 posts
Joined:
Offline
jesta
you almost had it. the trick is to compute the normals after the deformations.
I had a look at your .hip and tweaked it a bit to work.

Thank you so much. Now it works like it should. You rule. Five stars for this community.
  • Quick Links