Jump to content

Tree RIG Sway In Wind?


Atom

Recommended Posts

I have this FBX import of a tree rig with FK bone setup. Is there some way to make the tree sway in the wind automatically? Or convert this to some kind of spring based rig?

 

Is there a way to convert bones to curves so I could use this in a wire solver perhaps?

Untitled-1.jpg

Edited by Atom
Link to comment
Share on other sites

I was able to output the tree as curves only. But I only have the points for the curves, not individual primitives yet. If I could construct primitives from the points I might be able to perform some wire operations upon the tree.

I have some detection code, based upon neighbor count, but it is not really working right. Does anyone have an idea on how to detect the individual branches from a point cloud? Basically I am trying to create an i@id for each branch so I can use the Add node to make each line.

 

Untitled-1.jpg

Edited by Atom
Link to comment
Share on other sites

By measuring the distance between the current and the next point I have been able to reliably detect most branch end points. Now to figure out starting points...

// Get the number of points.
int npt = npoints(0);

// Loop through the points minus 1.
for(int i = 0; i < npt-1; i++) {
    // Get the distance to the next point.
    vector p1 = point(0,"P",i);
    vector p2 = point(0,"P",i+1);
    float dist = length(p2-p1);
    
    if (dist>ch("threshold")) {
        // This may be an end point.
        setpointattrib(0, "Cd", i, {1,0,0}, "set");
    } else {
        // In between point.
        setpointattrib(0, "Cd", i, {1,1,0}, "set");
    }

    // Set the distance to next point.
    setpointattrib(0, "dist", i, dist, "set");
}

 

Untitled-1.jpg

Link to comment
Share on other sites

Coming full circle, now that I have curves, I can use the Bones from Curves shelf tool to create a bone chain along the curve. But the tool only works on the first primitive.

Is there a way to make the tool run multiple times for each primitive?

Could I python exec() the tool, in a loop, and fake out kwargs?

Edited by Atom
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...