Jump to content

Recommended Posts

Hello everyone,

I am trying to recreate a volume trail node within an attribute wrangle (couple steps before, but the advection of the points is all within the wrangle)
When I create new points in said attribute wrangle, I can't have access to their position within the for loop they were created.

I am attaching the hip file. The attribute wrangle is highlighted in red.

volume_trails_VEX.hip

Link to comment
Share on other sites

- rather than doing it in detail wrangle use point wrangle as you want trail per point

- also you can create prims directly in wrangle too so no need for id

- addpoint() can take reference ptnum which it will clone with all the attribs so no need to import the attribs manually

- and to your question, no, it's not possible to access attributes from new points as the creation will happen at the end as a separate single threaded process, all you are doing with geometry creation functions addpoint() setpointattrib(), ... is queuing those for later

here is a simple pointwrangle volume trail code:

float step = chf("step");
int niter = chi("niter");

if (niter <= 0) return;

int prim = addprim(0, "polyline");

vector P = @P;
vector v = 0;

for (int i=0; i<=niter; i++){
    int pt = i == 0 ? @ptnum : addpoint(0, @ptnum);
    addvertex(0, prim, pt);
    
    P += normalize(v)*step;
    v = volumesamplev(1, "vel", P);
    
    setpointattrib(0, "P", pt, P);
    setpointattrib(0, "v", pt, v);  
}

 

 

volume_trails_VEX_fix.hip

Edited by anim
  • Like 3
  • Thanks 2
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...