prim_normal
3018 4 2- _Christopher_
- Member
- 767 posts
- Joined: 4月 2014
- Offline
- grayOlorin
- Member
- 1799 posts
- Joined: 10月 2010
- Offline
I use it quite a lot actually. Prim_normal returns the interpolated normal of a primitive at any given baricentric UV location on such primitive.
For example, if you wanted to blast all primitives facing away from a camera (given a cameraViewVector variable that you created previously) , you can do this:
.
.
.
vector primN = prim_normal(0, @primnum, 0, 0);
if (dot(primN, cameraViewVector) > 0)
{
removeprim(0, @primnum, 1);
}
this is akin to the primuv function, but to get primitive normals more directly without having to have an N attribute
For example, if you wanted to blast all primitives facing away from a camera (given a cameraViewVector variable that you created previously) , you can do this:
.
.
.
vector primN = prim_normal(0, @primnum, 0, 0);
if (dot(primN, cameraViewVector) > 0)
{
removeprim(0, @primnum, 1);
}
this is akin to the primuv function, but to get primitive normals more directly without having to have an N attribute
-G
- _Christopher_
- Member
- 767 posts
- Joined: 4月 2014
- Offline
- grayOlorin
- Member
- 1799 posts
- Joined: 10月 2010
- Offline
the U and V are the parametric coordinates of that particular primitive (i.e. baricentric coords of a triangle, or the U and V location of a nurbs patch). A lot of other functions/VOPs actually return those coordinates (i.e. the xyzdist and intersect VOPs return the u and v at the intersection point). if you just want the normal of a polygon prim, keep those at 0, 0, and you will be fine
-G
- _Christopher_
- Member
- 767 posts
- Joined: 4月 2014
- Offline
-
- Quick Links