Jump to content
Sign in to follow this  
Atom

Tree RIG Sway In Wind?

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

Share this post


Link to post
Share on other sites

Usually this is wire sim but all depends what accuracy you need.
You can try fast solution with "ok plusplus" grain trick, I really like it (00:17).

 

Edited by fencer

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Made it past one more step. I have a individual lines for my branches.

How would I leverage these lines in a wire solver to simulate wind or gravity effects?

Untitled-1.jpg

 

ap_detect_tree_branches.hiplc

Edited by Atom

Share this post


Link to post
Share on other sites

Converting to PopGrains I get some force influence, but the wind and noise tear things apart.

pop_grain_wind.gif

Share this post


Link to post
Share on other sites

Wire + wire glue constraint

Share this post


Link to post
Share on other sites

Thanks, I am playing around with that. I am trying a point deform on the final mesh using the wire simulation as the animated source. Not exactly natural but it does add some movement.

pop_grain_wind.gif

ap_detect_tree_branches.hiplc

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Wire sim with trees works not good for me. Its create mess in places where a lot of branches collide. And its happen in 16, in 15 was everything ok.

Edited by tamagochy

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
Sign in to follow this  

×