GSoC 2019: Custom Bevel Profiles

Thanks for the responses! I’m sorry I haven’t been more responsive. I’m still finishing up final exams, although I’m mostly finished.

I’ll try to respond to everyone here. You have some really helpful ideas!

I agree, this seems like an elegant solution! I do have a few concerns about pursuing this option though. One is that it doesn’t seem to support non-symmetrical profiles very very cleanly. (Like the profile pictured below). It looks like the reason chamfer method works well in your picture is that it’s a symmetrical profile. So each of the three edges intersect at the same center, etc… As the chamfer runs through for the third time, I could even see it making islands that aren’t connected to the main object.
Screenshot%20from%202019-05-16%2007-51-13
I tried to build a demonstration of what I meant here with the boolean modifier, but I ended up spending way too much time cleaning up geometry. Here’s what it looks like before I started to fix the third bevel. Maybe messiness is unavoidable in situations like this, but this looks a bit crazy.
3-way%20Intersection%20Chamfer%20Unsymmetrical

Thanks for this image! I may need to study that interpolation it does, it’s not quite clear how it decides what to do there yet.

I’m guessing the symmetrize field forces it into a symmetrical case which avoids some of the complexity I mentioned above. I thought it might be useful to keep that as a separate case in my implementation.

It’s looking like I will need a few of the same properties for sampling and picking the direction of the curve.

That looks great! I like that they have a selection of preset profiles. I wonder if it would be too difficult to add a way to save presets like the BoltFactory addon does.

I’m not sure about this. Blender already has a curve system, both as objects and the curves for color correction. I am planning to add the possibility to systems similar to both of those, so another option might not be necessary. What’s necessary here probably is a quick way to go back and forth between grease pencil stokes and meshes/curves, which might even already exist.

Wow! We’re getting ambitious! I think presets and icons will have to come last, after I’ve finished the basic functionality, but I agree that would be very nice.

4 Likes

Question, will you be able to save these profiles you make so you can reuse them for other projects? Would be pretty neat if you could. :slight_smile:

I would love to get that done! I’m not quite sure where it fits in the priorities though. Judging by how many people have mentioned it, it seems pretty important, but getting the core functionality done and making intersections work may be higher a higher priority for the summer.

1 Like

By the way, here is my most recent mock-up for what the custom profile UI could look like. The first thing I have to do is get the custom profile data piped into the bevel modifier, so I’m starting now by adding getting these properties added to the UI.

The idea behing the Sample only Nodes property (which needs a better name) is to override the number of segments and only draw straight lines between the curves on the plot above.

I will hopefully be able to reuse most of the elements from the existing CurveMapping user interface element. Priorities there are:

  1. Learning the API around that to see if I can get the necessary UI changes from the template just in Python.
  2. Figuring out how it stores its data to get that into the bevel parameters.
  3. Later on, sampling the curve between the points. (I will start with the “Sample only Nodes” case case where the only thing that matters is the nodes.
  4. Other lower priority tasks like making the plot more reactive to the other properties.
3 Likes

Didn’t even knew Modo could do that. Oh wait, I don’t use Modo =)).

1 Like

This proposal is fantastic! I wish it could be implemented some day! The ability to have multiple profile presets would be so neat and will save so much time!

2 Likes

will this be a feature for the tool itselfs as well and not only for modifier ?

1 Like

The feature will be for the tool as well as the modifier. The tool is a bit harder to implement though, there is a different system for passing the arguments to the operator whereas the modifier just calls the operator’s C code directly. So for right now I’m focusing on the modifier.

2 Likes

Hi, another update here! (and feedback solicitation)

First, I wanted to give a link to a log that I’ve been keeping: https://wiki.blender.org/wiki/User:HooglyBoogly/GSoC2019/Log Here’s a sample ;):

May 30

Today I finished getting the sampled info into the ProfileSpacing struct. That struct contains the 2D locations of the profile’s points before it gets transformed into 3D on top of a plane. Unfortunately I think this means I’ve completed most of the more straightforward part of using the profile information in bmesh_bevel.

I also spent way too long today dusting off my GDB knowledge diagnosing some stupid seg-faults that I caused with some typos and another silly mistake. It’s all part of getting up to speed on a new project, and it’ll be faster in the future, but it still feels stupid in retrospect.

Next, I could either focus more on getting the profile UI widget drawing fixed out, or see what I can do with this profile-spacing info in the simple weld cases I’ve talked about.

If anyone wants to follow along and provide feedback, that’s a place to do it!

A Question about profile orientation

One question that’s come up is how to deal with the arbitrary choice of which side of the profile becomes the right side of the widget and which the left, in other words the orientation of the custom profile. After some discussion with @Howard_Trickey, I’m leaning in the direction of choosing a direction based on a somewhat arbitrary metric like the distance to the object origin and providing a reverse button like I have on the mockups which would flip the profile around.

This would mean that in order to adjust the direction separately for differnent parts of the bevel you would have to do two separate actions. Does this seem like too much of a limitation?

The choice between symmetric or unique profiles would be nice too. In the former, you’d essentially only draw half of the bevel, and the other side would be mirrored, sidestepping any orientation issues or trouble with keeping both sides the same.

1 Like

I agree, this could be quite helpful. I think it would make the amount of code that would change much smaller. The profiles are constructed one half at a time right now, so if each half were the same the only thing that would have to change is the position of the vertices the bevel code created, not the manner by which they’re created.

At the end of the project though, when the more general non-symmetric case is completed, I think the only difference between this “Symmetric” check-box and a manually symmetric profile would be the intersections. So I’ll probably tackle this option when I start with the more complicated intersections.

1 Like

I’m not sure about this. Blender already has a curve system, both as objects and the curves for color correction. I am planning to add the possibility to systems similar to both of those, so another option might not be necessary. What’s necessary here probably is a quick way to go back and forth between grease pencil stokes and meshes/curves, which might even already exist.

It does exist (Convert to Geometry). GP strokes have some benefits, for example they can be sculpted, in 2.8 they are now objects so they can be thought of as a collection of curves. Or, presets. :stuck_out_tongue:

Of course you don’t have to add this functionality (it can be done as an addon or whatever anyway) but it would be a good addition.

Hi all! I’m making progress on the weld case where two beveled edges come into the same vertex, and right now the profiles are generated, but with inconsistent orientations. I’ve made a plan to tackle this and I figured I would post it here to see if anyone had thoughts, because it will probably be a large undertaking to solve this.

Regularizing Orientations Along Contiguous Beveled Edges

(Excerpt from notes page)

One of the problems I’m introducing with custom bevel profiles is the orientation of the profile. One of the problems is more normal-- as I modify the way that the profiles get built, I might mistakenly flip the indices of the profile vertices, so the connections to the next profile along the line will be flipped, creating a whole segment of messed up geometry.

The other (possibly more problematic) situation is when the code chooses a different orientation for the profile, so the shape is rotated the other direction compared to another profile. The indices could match up or they couldn’t, either way the connection to the next profile will not be correct. These two situations I described are likely part of the same problem, and the only way to fix it will be to maintain consistent orientation of the profile along contiguous beveled edges.

There are two types of contiguous beveled edges: cycles and chains. I need to write code that travels down beveled edges to find these contiguous sections. As it travels along the edges it will carry over the orientation of the custom profile by making sure it starts at the same side of the bevel, or the new BoundVert that’s linked to the last one with an edge. Here’s the process:

  1. Start at a random BevVert.

  2. Travel along each EdgeHalf connected to the vertex, marking which of the BoundVerts the profile will start at when a new vertex is reached.

  3. Stop when there is no continuation of the beveled edge, or when the next BevVert has already been visited.

  4. As long as there is still another unvisited BevVert, start the process there again, and in the end all of the BevVerts will be visited.

This should give enough information to pick which BoundVert to start building the bevel profile from in build_vmesh. However, I’m not sure how this will interact with intersections of >2 beveled edges. As soon as a beveled edge comes into one of these larger intersections the profile will be messed up to some extent anyway, so maybe I should treat the a >2 way intersection as another stopping point for the travelling code. But then it’s not clear that anything would happen on a shape like a cube where all of the BevVerts have 3 incident beveled edges.

3 Likes

You could indeed stop looking for chains/cycles when you hit a vertex with more than two beveled edges into it. As you say, you are eventually going to have to tackle the hard case of what to do at the vertex for the “vertex mesh” at such a junction of >2 asymmetric profiles. You and others had a bit of discussion about this at the beginning of this topic.

Ideally, you would continue chains/cycles even through vertices that have >2 beveled edges in, so that, say, the top of a building would get a consistent-looking cornice around it even if there are other vertical beveled edges meeting the top (though would a user actually do that? seems an argument for not worrying about this case too much, at least to start). You would need some tie-breaking rule to say which edge to continue a chain along. One would be: minimize the turning angle. Of course this is of no help with a cube, but it would help with a cylinder of > 4 sides. Another tie-breaking rule might be to prefer the top of the profile to be on some axis, say the z axis, so choose the edge that is more perpendicular to the z axis.

Indeed a tricky question. I guess there is no correct solution to this, as some intersections have probably no real solution. Howards notes are on spot, I looked a bit at houdini and it has exactly the same problems with this.

I guess the most important thing is to find long continous bevel chains and try to keep these going.

And for the user it’s always possible to do the bevel in a two step operation, do bevel profile on vert group A, do inverted bevel profile on vert group B.

The usecase for having asymetric profile all over a model isn’t also very clear to me. I can see it being useful for some sort of procedural panel or line inset. I expect this to be used in much more constraint models, like some sort of profile, where the bevel plays a major shape defining role - but thats just my impression, so other useres might have different ideas here…

Thanks for the advice both of you. I have my first results from this today, and it worked surprisingly well! I have a fair amount of testing and fixing still to do, but in general it works for the sort of weld cases I’ve been testing:

The metric I chose to implement for continuing a path’s orientation through a >2-way intersection is to continue the orientation as long as there is a clear choice for the best relative angle through the vertex to the next edge. If the best relative angle is ~10 degrees better than the second best angle, the consistent profile orientation path will continue. If there isn’t one obvious choice for best path, the geometry at the vertex is not going to be clean enough for a continuous profile orientation to matter anyway.

I hope this procedure will enable consistent orientations on something like the top ring of a cylinder. The more parallel ring’s orientation will remain consistent, but the lengthwise edge’s profile’s orientations shouldn’t matter.

20 Likes

seeing this go nicely I wonder how hard would be to implement Custom curves fallofs for the proportional editing. Along with the gradient coloring worked by Benjamin Sauder it can be some of the most robust features blender has to offer , instantly a lot more powerfull to the point it can substitute some deform modifiers for ex.

1 Like

Excited about this!

  • Would you consider integrating a powerful feature allowing to use Bevel also on FLAT surfaces (bevel weighted edges) with displacement offset as in Houdini. This would enable very powerful workflow for hard surface panels:

    Note: It’s not same as EdgeSplit+Solidify+Bevel.

Thanks, keep up the good work!

7 Likes

how exactly is this feature called in houdini ?

Standard polyBevel node with Profile. Profile defines Height (e.g >0.5 raises, <0.5 lowers). Would be useful for architectural work, hard surface (panels), if asymmetry is possible then also potentially cloth seams and work a like. It’s somewhat possible to emulate it in Blender with WeightEdit nodes, but it’s far from real solution.

1 Like