How to recompute the normal with VEX?

   997   3   0
User Avatar
Member
2 posts
Joined: 7月 2023
Offline
Im trying to recompute the normal with the computenormal vex function in order to get the same result as using a Normal sop node. But no matter how I write the code, I always get a wrong normal showing on the back faces of the geo.
User Avatar
Member
1035 posts
Joined: 4月 2017
Offline
I also can't make that function work. I always get a normal of {0, 0, 0} on all points.

What's the reason for not using the normal sop?
User Avatar
Member
2111 posts
Joined: 9月 2015
Offline
The docs say it's for use in shading context and that it's obsolete for SOP context.
User Avatar
Member
8730 posts
Joined: 7月 2007
Offline
in Point Wrangle:

- if you don't have N attribute on polygonal geo yet, then simply writing
v@N;
will create it based on topology

- if you already have N attribute, then you can check Bindings/Update Normals If Displaced
but then you need to modify v@P for it to trigger such update, so if your Wrangle doesn't modify v@P, you can do at least this to trigger the update:
v@P;
Edited by tamte - 2023年9月13日 01:24:55

Attachments:
create_or_update_N_in_wrangle.hipnc (101.8 KB)

Tomas Slancik
FX Supervisor
Method Studios, NY
  • Quick Links