Jump to content

How should I make a pattern that spreads like a flower around the point in the video and image?


immeen

Recommended Posts

  • 3 weeks later...

@immeen
Only thing that you need to make those patterns its this Code Found on Sidefx Forum  + this File Have Fun + you can combine that with file from @konstantin magnus , for shiny effect search Glow :P
Run on Primitives
 

// Construct center point
vector center = 0;
// Get the points of our primitive
int srcpts[] = primpoints(0, @primnum);
int srcvtx[] = primvertices(0, @primnum);

float weights[];
// Create our attributes to store our origin points.
// Note the last parameter determines type and defaults
// (which is irrelevant for arrays)
addpointattrib(0, 'sourcept_num', srcpts);
addpointattrib(0, 'sourcept_weights', weights);
addvertexattrib(0, 'sourcevtx_num', srcvtx);
addvertexattrib(0, 'sourcevtx_weights', weights);
addprimattrib(0, 'sourceprim_num', int(-1));
addprimattrib(0, 'sourceprim_uvw', vector(0));

foreach (int pt; srcpts)
{
    center += point(0, 'P', pt);
    append(weights, 1.0 / len(srcpts));
}
center /= len(srcpts);

int centerpt = addpoint(0, center);
setpointattrib(0, 'sourcept_num', centerpt, srcpts);
setpointattrib(0, 'sourcept_weights', centerpt, weights);

float singleweight[] = { 1.0 };
for (int subface = 0; subface < @numvtx; subface++)
{
    // Set the point weights for single-sourced points
    setpointattrib(0, 'sourcept_num', srcpts[subface], srcpts[subface:subface+1]);
    setpointattrib(0, 'sourcept_weights', srcpts[subface], singleweight);
    
    // Create our triangle.
    int tri = addprim(0, 'poly');
    setprimattrib(0, 'sourceprim_num', tri, @primnum);
    int vtxidx = subface;
    int v1 = addvertex(0, tri, primpoint(0, @primnum, vtxidx));
    setvertexattrib(0, 'sourcevtx_num', v1, -1, srcvtx[vtxidx:vtxidx+1]);
    setvertexattrib(0, 'sourcevtx_weights', v1, -1, singleweight);
    vtxidx = (subface+1) % @numvtx;
    int v2 = addvertex(0, tri, primpoint(0, @primnum, vtxidx));
    setvertexattrib(0, 'sourcevtx_num', v2, -1, srcvtx[vtxidx:vtxidx+1]);
    setvertexattrib(0, 'sourcevtx_weights', v2, -1, singleweight);
    int v3 = addvertex(0, tri, centerpt);
    setvertexattrib(0, 'sourcevtx_num', v3, -1, srcvtx);
    setvertexattrib(0, 'sourcevtx_weights', v3, -1, weights);
}
removeprim(0, @primnum, 0);

 

jpgf.jpg

sss.jpg

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

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

×
×
  • Create New...