Extrude Polygon Along Curve

Post Reply
Chris_TC
Posts: 411
Joined: 22 Mar 2010, 17:43

Extrude Polygon Along Curve

Post by Chris_TC » 24 Dec 2011, 15:15

Since it was suggested several times, here's a test video.


This is based on the "Cable compound" whose construction I detailed in my bridge tutorial video part 2. However, it doesn't use any repeat nodes anymore, and I adapted it to work with an input polygon and curve.

There are still certain problems. The new geometry is currently a separate polygon island - it should of course be welded automatically. And there are some issues with orientation and upvectors. If I can't solve these (or don't have the time to), I'll post the unfinished compound for others to take a look. Or maybe someone else comes up with a fully working solution right away (Fabricio? :D )

User avatar
ActionArt
Posts: 853
Joined: 25 Nov 2010, 18:23
Location: Canada

Re: Extrude Polygon Along Curve

Post by ActionArt » 24 Dec 2011, 16:02

Nice! Would it be able to cap both ends automatically?

Chris_TC
Posts: 411
Joined: 22 Mar 2010, 17:43

Re: Extrude Polygon Along Curve

Post by Chris_TC » 24 Dec 2011, 16:18

ActionArt wrote:Nice! Would it be able to cap both ends automatically?
Capping the end is extremely simple, I just haven't added that yet. Adding control for scaling the thickness or twisting along the length is also quite easy.
I find that the main difficulty lies in maintaining a reasonable upvector. Currently, the extrusion can have some weird flips somewhere in the middle depending on the curve.

iamVFX
Posts: 697
Joined: 24 Sep 2010, 18:28

Re: Extrude Polygon Along Curve

Post by iamVFX » 24 Dec 2011, 22:54

I make up vector of the curves by this way, maybe you find it useful. Null up vector prevents vector to be flipped when curve is rotated with it
Attachments
curve_upvector.png
curve_upvector.png (12.61 KiB) Viewed 9098 times
curve_upvector.rar
(109.78 KiB) Downloaded 304 times

Chris_TC
Posts: 411
Joined: 22 Mar 2010, 17:43

Re: Extrude Polygon Along Curve

Post by Chris_TC » 25 Dec 2011, 00:38

iamVFX wrote:I make up vector of the curves by this way, maybe you find it useful. Null up vector prevents vector to be flipped when curve is rotated with it
Very interesting, thank you!

So it appears that your magic lies in using a Euler to Rotation and a Rotate Vector. I don't know what exactly this does, but I'll use it on the compound and see if it solves the issues I've had.

iamVFX
Posts: 697
Joined: 24 Sep 2010, 18:28

Re: Extrude Polygon Along Curve

Post by iamVFX » 25 Dec 2011, 10:34

I'm not sure how it works in this case too, but the fact is that if there will be some crazy rotations along the curve you'll just take a null and move it around to fix it... Not so elegant way I guess but if you want rotate a whole curve you just rotate it with null and there will be no change in polygons direction

fabricio.chamon
Posts: 94
Joined: 09 Jun 2009, 23:47

Re: Extrude Polygon Along Curve

Post by fabricio.chamon » 02 Jan 2012, 05:09

the way I do it (as suggested by Guillaume LaForge on the "Create Extrusion along Strands" compound) is to iterate over all curve points and calculate the current normal by rotating the previous normal. This makes every normal dependant on the previous segment, thus making them continuous.

Here's one image showing the math for 2nd point on the curve. Also the icetree.

I think the images will explain better than I could with words, but let me know if you have any problems.

and btw, nice job Chris!
Attachments
Normal Rotation
Normal Rotation
normal_rotation.jpg (157.96 KiB) Viewed 9029 times
icetree
icetree
icetree.jpg (220.86 KiB) Viewed 9029 times

fabricio.chamon
Posts: 94
Joined: 09 Jun 2009, 23:47

Re: Extrude Polygon Along Curve

Post by fabricio.chamon » 02 Jan 2012, 05:27

...oh, and here is a simple scene that I did to review some stuff. It is as simple as it can get (no optimizations, so expect lots of repeat nodes around). It focus on making the core extrusion functionality easily readable on the icetree.

Just in case you want to check the normal rotation logic...
Attachments
simple_extrude_along_curve.rar
(154.25 KiB) Downloaded 337 times

Chris_TC
Posts: 411
Joined: 22 Mar 2010, 17:43

Re: Extrude Polygon Along Curve

Post by Chris_TC » 02 Jan 2012, 16:05

Thank you for the clear explanation! Your image shows well how the logic needs to work, so it shouldn't be too difficult to implement. Will report back :)

User avatar
Hirazi Blue
Administrator
Posts: 5107
Joined: 04 Jun 2009, 12:15

Re: Extrude Polygon Along Curve

Post by Hirazi Blue » 12 Jan 2012, 21:03

@Chris_TC - If it takes longer to complete it, would it be possible for you to upload the incomplete version of the compound - the one you apparently based the video on - so I can take it apart in private and find out where exactly my own sorry attempt went horribly wrong?
;)
Stay safe, sane & healthy!

Chris_TC
Posts: 411
Joined: 22 Mar 2010, 17:43

Re: Extrude Polygon Along Curve

Post by Chris_TC » 19 Jan 2012, 21:28

Sorry for taking so long to answer. I've only now had a chance to take another look at my compound. I implemented Fabricio's/Guillaume's awesome technique, and I think I got that right. But for some reason I've set it up such that I only get a good result when the input polygon is roughly facing the +Z axis* Something's definitely not right.
*This has nothing to do with Fabricio's technique by the way. I remember having this issue back when I first made the compound.

I don't know how soon I can get back to it, so here's the compound like you asked. Unfortunately, some of it is hard to read - I initally avoided Repeat nodes, which makes the logic much bigger. However, the Normals technique seems to require a repeat node, because each normal depends on the previous one.
Attachments
Extrude Polygon Along Curve.xsicompound
(148.17 KiB) Downloaded 256 times

User avatar
Hirazi Blue
Administrator
Posts: 5107
Joined: 04 Jun 2009, 12:15

Re: Extrude Polygon Along Curve

Post by Hirazi Blue » 20 Jan 2012, 12:00

Thanks... :ymhug:
I will try to "decipher" it & that in itself will be a valuable learning experience I'm sure
Stay safe, sane & healthy!

Chris_TC
Posts: 411
Joined: 22 Mar 2010, 17:43

Re: Extrude Polygon Along Curve

Post by Chris_TC » 20 Jan 2012, 21:48

Sure thing. I recommend to look at each sub tree step by step. Unplug things and visualize values starting on the left. Then keep track of them and see how they change as you move to the right. That's how I'd decipher my own tree now if I had to.

Also, always try to work with simple objects. Instead of applying the compound on a mesh with 10,000 polygons and using a really long curve, I'd just use a cube and a linear 3-segment curve or something.

Post Reply

Who is online

Users browsing this forum: No registered users and 15 guests