# a question for making custom normal on Point

## Recommended Posts

Hi guys.

I was wondering how I make normal like this image below.

there is a cloth surface, and i need to make custom normal direction

have any idea? thanks.

##### Share on other sites

You just mean directional cross?
@N = cross(@N, {1,0,0});

##### Share on other sites

thanks fencer, but it doesn't work.

I made a default N with Facet. then I want to make N which is head to down along edges.

##### Share on other sites

I tried to use Guide Tangent Space node so I make tangent attribute,

then I cross product between my N and tangent, it works!!

custom_N.hip

##### Share on other sites

Guide Tangent Space didn't compute vectors that necessary looking down, which IMO contradicts with "make N which is head to down along edges". If you won't be happy with GTS output on the real geometry: at first, decide the unique characteristic the target vector will have. Does it points to point's neighbour with least/largest ptnum? Does it points along edge closest to {0, -1, 0} direction? The idea behind choosing one edge over another. That will be a big part of the answer.

Edited by f1480187
##### Share on other sites

Yes. you're right f1480187.

When I applied it to my real geometry, it was not correct.

So, I just tried to use Sort node.

I sorted points using 'Along Vector' {0, -1, 0}, then I made normal with vop ; I used subtract between position of ptnum and ptnum-1.

It's not exactly correct, but it is pretty close to what I want, cuz I just needed velocity for popnet.

##### Share on other sites

Here the snippet which allow to select such down edge more reliably. It works better than height sorting method in cases, where short edges with better "down ratio" may have greater Y than long edges.

```// Point wrangle.

int nbs[] = neighbours(0, @ptnum);

// Find edge best aligned with negative Y.
float dots[];
foreach (int nb; nbs)
{
vector pos = point(0, "P", nb);
vector dir = normalize(pos - @P);
append(dots, dot(dir, {0, -1, 0}));
}
int best_nb = nbs[find(dots, max(dots))];
vector best_edge = point(0, "P", best_nb) - @P;

v@dir = normalize(best_edge);```

down_edge.hipnc

##### Share on other sites

Thank you, f1480187!!!!

using dot product then find max value, it would be so useful for me to do procedural animation.

Thanks again

## 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.

×   Pasted as rich text.   Paste as plain text instead

Only 75 emoji are allowed.

×   Your previous content has been restored.   Clear editor

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

×
×