Jump to content
CinnamonMetal

Add Vertex to Prim

Recommended Posts

vector midpoint = addvertex(geoself(),0,lerp(point(0, "P", vp1), point(0, "P", vp2), 0.5));

I want to add a vertex to the primitive, but I'm not seeing an extra vertex on  the primitive ?

Share this post


Link to post
Share on other sites

I guess you should not squeeze functions into one another (eg point() into lerp()). This works in a primwrangle:

float slide = chf('slide');
int prim_pts[] = primpoints(0, @primnum);
vector pt_pos_0 = point(0, "P", prim_pts[0]);
vector pt_pos_1 = point(0, "P", prim_pts[-1]);
vector pos = lerp(pt_pos_0, pt_pos_1, slide);
int pt = addpoint(0, pos);
int midpoint = addvertex(0, @primnum, pt);

 

  • Thanks 1

Share this post


Link to post
Share on other sites

I was already storing the primVertices in an array followed by getting the index of two of the primitives vertices and storing them in a variable.

vector pt_pos_0 = point(0,"P",vp1);
vector pt_pos_1 = point(0,"P",vp2);

Since I'm using a variable from what I know I can't use -1; then followed linear interpolation etc.  The problem is the vertex order is not consistent as in it changes causes the object to have it's normals all inside and out in the viewport ?

Share this post


Link to post
Share on other sites

My previous post didn't make much sense :mellow:

When adding a vertex to a primitive, this is the result; rather then the vertex added to the primitive while keeping the normals in tact, unless this is expected in shaded mode ?

Is it possible to re-position the vertex before it's essentially baked onto the primitive ? The slide parameter re-positions the vertex which alters the primitive.

 

 

vertexissue.png

Edited by CinnamonMetal

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×