Gradient scaling polywire.

   6027   10   1
User Avatar
Member
27 posts
Joined: Dec. 2017
Offline
I am currently making a tree.

The tree is made of a trunk and 3 sets of branches that are made up of curves.

I want to use the polyWire sop to set a gradient thickness of the trunk and its connected branches.
Since the trunk gets smaller the higher it goes I want the branches growing from the trunk to get the same thickness depending where it spawns from the trunk.

I will be linking a video as reference:

.

cheers!
User Avatar
Member
708 posts
Joined: Feb. 2017
Offline
Hey zahapp,

when using a resample node on your curve you can set a Curve U Attribute. You can reshape the attribute after the resample using a wrangle node with a chramp function. Use it in the polywire as the wire radius.
For the branches, you can use an attribute transfer to get the curve u attribute on the trunk. use this to multiply your branch wire radius.

Cheers
CYTE
User Avatar
Member
384 posts
Joined: April 2017
Offline
Find Shortest Path is great for this. Make a group for the base of the trunk, and another group for the tip of each branch (an easy way to start is by grouping all of your skeleton points that have only one neighbor). Use Find Shortest Path to compute a “cost” attribute starting from the root and going to each branch tip. Promote that attribute to “maxcost” using the Maximum mode, then you can turn that into a ratio by dividing cost/maxcost.

Then you can define width using a Point Wrangle, something like this:
f@width = chramp(“width_ramp”, @cost/@maxcost) * ch(“width_scale”);

Tell your PolyWire SOP to use @width as the line width, and you should be able to sculpt the profile of the branches using that ramp control.
MOPs (Motion Operators for Houdini): http://www.motionoperators.com [www.motionoperators.com]
User Avatar
Member
27 posts
Joined: Dec. 2017
Offline
CYTE
Hey zahapp,

when using a resample node on your curve you can set a Curve U Attribute. You can reshape the attribute after the resample using a wrangle node with a chramp function. Use it in the polywire as the wire radius.
For the branches, you can use an attribute transfer to get the curve u attribute on the trunk. use this to multiply your branch wire radius.

Cheers
CYTE
Thanks for your input!
I managed to use the curveu for the scale of my trunk but I did not manage to copy the trunks curveu attribute to actually effect the branches how I wanted. I am not sure if I am doing it correctly though. If you have time for a more practical showcase I will gladly put up a file here!
Edited by Gnomesnob - Jan. 22, 2019 18:55:40

Attachments:
simpleTreeTest.hipnc (142.4 KB)

User Avatar
Member
27 posts
Joined: Dec. 2017
Offline
toadstorm
Find Shortest Path is great for this. Make a group for the base of the trunk, and another group for the tip of each branch (an easy way to start is by grouping all of your skeleton points that have only one neighbor). Use Find Shortest Path to compute a “cost” attribute starting from the root and going to each branch tip. Promote that attribute to “maxcost” using the Maximum mode, then you can turn that into a ratio by dividing cost/maxcost.

Then you can define width using a Point Wrangle, something like this:
f@width = chramp(“width_ramp”, @cost/@maxcost) * ch(“width_scale”);

Tell your PolyWire SOP to use @width as the line width, and you should be able to sculpt the profile of the branches using that ramp control.

Greetings!
Thank you for your response.

I tried your approach as much I could. I am having a little hard time to actually group the last point of all my branches as I do not know of a practical solution to do it.

But just to try out your process I manually grouped the last points of my first section of branches and used the shortest path sop like you said.
I am getting values from low to high as I should but you kind of lost me at promoting the cost to “maxcost”. If I use a attribute promote to promote the cost to a maxcost don't I lose the “cost” attribute aswell?
User Avatar
Member
384 posts
Joined: April 2017
Offline
try this file, you can promote without losing the original attribute.

Attachments:
lsys_width_cost.hip (98.6 KB)

MOPs (Motion Operators for Houdini): http://www.motionoperators.com [www.motionoperators.com]
User Avatar
Member
27 posts
Joined: Dec. 2017
Offline
toadstorm
try this file, you can promote without losing the original attribute.

This does seem to look like how I want my tree to act aswell. However, since I am not using a l-system to generate my tree the “find shortest path”-sop tells me there is no connection between the “start”-point and “end”-point. I assume it is because the branches are not really connected although I have used the fuse node and tried the stitch node, they are still separate primitives.
Is there a way to merge my curve primitives into one primitive?
Edited by Gnomesnob - Jan. 22, 2019 19:20:04
User Avatar
Member
384 posts
Joined: April 2017
Offline
Your fuse threshold simply wasn't high enough to actually fuse the points together.

Attachments:
simpleTreeTest_toadstorm.hipnc (180.0 KB)

MOPs (Motion Operators for Houdini): http://www.motionoperators.com [www.motionoperators.com]
User Avatar
Member
27 posts
Joined: Dec. 2017
Offline
toadstorm
Your fuse threshold simply wasn't high enough to actually fuse the points together.

I see, my mistake. However I also tried this with another project and got some weird results.

The end of the branches varies from each other and I don't know why, shouldn't they all have the same min width value?
Edited by Gnomesnob - Jan. 22, 2019 20:06:19
User Avatar
Member
384 posts
Joined: April 2017
Offline
Think about it… if you're computing the width based on the traversed distance from the root of the tree, the lower branches are going to come in with a lower “cost” attribute than the higher branches.

If you want all the branches to end with the same tip width, you'll have to compute their costs individually before they're fused to the main trunk. One thing you could try is computing the width attributes for each branch, then for the main trunk, and then when copying the branches onto the trunk, add the width attribute to the “Mult” column in the “To Point” row of the Copy SOP.
MOPs (Motion Operators for Houdini): http://www.motionoperators.com [www.motionoperators.com]
User Avatar
Member
27 posts
Joined: Dec. 2017
Offline
That makes sense! I will try it out tomorrow.
Thank you for your help, much appreciated!
  • Quick Links