JacquesLucke / animation_nodes

Node based visual scripting system designed for motion graphics in Blender.
Other
2.29k stars 342 forks source link

Proposal: Procedural Curve Chamfer #1690

Open dapa5900 opened 3 years ago

dapa5900 commented 3 years ago

Hi,

is it possible to add a procedural curve chamfer option / node? It should basically do the same on curves what a bevel modifier is is doing in Vertex mode. Please see here for reference:

bevelReference

It should have the options to set the radius/offset of the chamfer as well as the subdivisions/segments.

Please find here as well a reference of a C4D-Plugin that does that:

chamferCurve

Thanks!

Gerstmann-Bradley commented 3 years ago

@OmarEmaraDev, Spline from Object Node currently only works on Either Curve or Text Object. Can there be a way to convert mesh to spline procedurally using AN? Like simplify the following workflow using Spline from Object node. I think this approach will be more generally useful to users.

image

OmarEmaraDev commented 3 years ago

@Gerstmann-Bradley Constructive modifiers in Blender don't operate on splines, Blender first convert the spline into a mesh then apply the modifier. So all information about splines are lost at this point. So really, the best you can do is your setup above or the Splines From Edges node.

OmarEmaraDev commented 3 years ago

I am trying to think of a good design for this operation. We have two types of curves, poly and bezier.

Poly curves should be straightforward, a per point radius can be provided by the user to control the bevel amount at each point. Perhaps another level of control is an option to determine which points gets beveled and which don't.

Bezier curves on the other hand seems a bit problematic. Would it make sense to bevel something like a bezier circle? Probably not. So should the node leave "smooth" handles alone and only affect sharp ones? Or should we split those smooth points somehow and try to maintain smoothness?

What do you think is a good design for this node?

dapa5900 commented 3 years ago

@OmarEmaraDev

Good questions. Well I think you're actually right, that already smooth handles don't need a procedural chamfer. From a workflow perspective I think this use case is usually desired when you want to add smoothness to a quite primitive basic shapes: like for example round the corners procedurally of a rectangle curve while maintaining the simple and easy to edit base curve shape or I for example previously in Cinema4D created an abstract street layout where I needed to change the street pattern quite easily but also needed to have round corners on the streets. When you already created a smooth curve with beziere handles I guess you want to have full artistic control over the final curve so yes, I would say this should only affect sharp corners. In the latter case you could anyways still add the existing smooth node in case your wanted to smooth your curve even more, right?

I think it's a good idea to also feed in a selection to the node and maybe even a weight per curve point to allow for different radius sizes. How could these selections (and weighting) be made? Via falloffs? Is it somehow possible to also set manual selections via viewport clicking (also in general for animation nodes, maybe via id keys?)

Thank you!

OmarEmaraDev commented 3 years ago

In the latter case you could anyways still add the existing smooth node in case your wanted to smooth your curve even more, right?

Smoothness is not exactly defined in this case, what I was proposing is to instead subdivide the point and maintain the existing smoothness. Still not sure how this will work. I will give it more thought.

Is it somehow possible to also set manual selections via viewport clicking (also in general for animation nodes, maybe via id keys?)

Using contextual information in the node tree such as selection is probably not a good idea. ID keys might be a good option, but we don't currently support that. I guess we can add support for that separately.


Okay. Thanks for the feedback. I will give it a bit more thought and hopefully implement a variant soon.

dapa5900 commented 3 years ago

@OmarEmaraDev

You might also want to check this video for some feature ideas how this could work: https://youtu.be/unyR8G6BdDI

OmarEmaraDev commented 3 years ago

@dapa5900 I already did the math for the poly spline chamfer, still haven't figured out bezier though. I might just add the poly spline version for you to test this Wednesday and follow it with bezier later. Sorry for the delay.

OmarEmaraDev commented 3 years ago

@dapa5900 Implemented in 4c8e56b. Let me know if you have any feedback.

https://user-images.githubusercontent.com/25300994/116715754-483dbb00-a9d7-11eb-9a9e-05f8783ccea1.mp4

Gerstmann-Bradley commented 3 years ago

Omar, I have a side question, there was a long-standing proposal at #1332 talking about nurbs curve support. Chamber really reminds me about that. I wonder is there any difficulty for it being delayed so long?

OmarEmaraDev commented 3 years ago

@Gerstmann-Bradley NURBs are a completely different type of curves, so the code for all the spline operations would need to be written specifically for BURBs. And they don't seem to be used a lot. In other words, big project, little motivation. What do you want NURBs for exactly?

Gerstmann-Bradley commented 3 years ago

@Gerstmann-Bradley NURBs are a completely different type of curves, so the code for all the spline operations would need to be written specifically for BURBs. And they don't seem to be used a lot. In other words, big project, little motivation. What do you want NURBs for exactly?

Upon creating a complex curve in 3D space, either for modeling or creating paths, working with Bezier handle is very difficult, so I ended up using lots of Nurbs which provides lots of auto-smoothing result. At some point I would say personally I use more Nurbs than the other two types of curve. But perhaps bevel spline node now can help with the issue, I'm not yet sure. In the worst case, at least the old workaround is still usable. If you think it's not urgent or worthy to implement it's ok, I was just wondering.

OmarEmaraDev commented 3 years ago

@Gerstmann-Bradley What if we convert the NURBS into Bezier when reading them from Blender? So you would still have them as curves in Animation Nodes. Would that be satisfactory?

Gerstmann-Bradley commented 3 years ago

@Gerstmann-Bradley What if we convert the NURBS into Bezier when reading them from Blender? So you would still have them as curves in Animation Nodes. Would that be satisfactory?

Absolutely yes. As long as the shape is maintained, what happens internally isn't something I personally would bother. That's why the previous workaround works. It just creates too many points and the requirement for regenerating a spline feels weird.

OmarEmaraDev commented 3 years ago

@Gerstmann-Bradley Alright. I am not sure about the technicalities yet, but I will look into it.

dapa5900 commented 3 years ago

hi @OmarEmaraDev

thank you for implementing the functionality and sorry for the late reply.

What is the best way to get the AN build with new features implemented to test them? Is this part of the public release already? So far I always downloaded the latest build from here: https://blender.community/c/graphicall/0hbbbc/

However since a while after installing the addon with this package it's telling me that I need 2.93 which I don't use yet as I'm waiting for the production ready LTS release (for stability reasons). Also as a general question: Is there a quicker way to do the whole remove, restart, install addon procedcure, like for example by just deleting the old AN folder from the "scripts" folder and copy the new one directly in there or are problems expected when doing it this way? (I don't know if installing an addon via the Blender preference does some kind of registering or something like this...?)

From your demo gif I would say it looks good. Would there be a way to also change the "resolution of the beveling"/the subdivisions? Also it would be nice if you can add a "flat"-mode, so that we get a straight line between the two endpoints of the radius. I guess with a "resolution" option this could as well be done by setting the resolution to 0.

thank you!

OmarEmaraDev commented 3 years ago

@dapa5900 About 15 minutes after we commit anything to Animation Nodes, the build becomes available there as the "Latest" one: https://animation-nodes.com/#download, so just download from there. The builds from graphic all are not maintained by us, and are not updated automatically.

Latest AN builds track latest Blender, and we can't support older version due to missing functionalities or different APIs.

Blender doesn't do anything special when installing the add-on, feel free to delete the folder and put the new one and it should work.

Beveling is implemented as two Bezier handles approximating a a circular arc, in other words the resolution is completely controlled by the resolution of the spline itself. So just increase the spline resolution.

We can add a flat mode. But I will try to support Bezier splines first before implementing that.

dapa5900 commented 3 years ago

@OmarEmaraDev

Great, thanks for the information.

Gerstmann-Bradley commented 3 years ago

Since Omar didn't mention, I will add several notes: The link provided by Omar doesn't include "Extra Nodes". Previous link from Blender Community Include Extra Nodes. AN+EN Pack is a derivative managed by @3DSinghVFX, if he doesn't merge upstream with native AN, newest feature of AN isn't available. According to him, he has to do everything manually, including the post from Blender Community. Thus I imagine the delay can be foreseen at multiple levels. I recommend download AN+EN at https://github.com/3DSinghVFX/animation_nodes/releases. This is one level earlier than Blender Community Post. But still can be delayed due to previously mentioned reason.

At the end, you can know the status based on commit date image image Current AN+EN does include bevel node in both EN github and Blender Community.

dapa5900 commented 3 years ago

@Gerstmann-Bradley

Thanks a lot!