GSoC 2019: Bevel Profiles Weekly Reports

Week 1

(Week 1 Daily Log)

This week was definitely a huge learning experience for me. I’m getting more comfortable with the bevel code and how to work in it, and as I learn more I can make changes faster. I’m trying to approach everything carefully at this point; I’m writing a lot, whether it’s just thoughts, plans, or questions. I think this will help keep my plans solid in the future.

Here are some tasks I completed this week:

  1. I learned how to pass information from the bevel modifier properties into the bevel code
  2. I got linear sampling of custom profiles working
  3. Basic editing of custom profiles now works in the modifier UI.
  4. I accumulated a lot of notes about how bevel works and about the changes I will need to make.
  5. I started to lay out plans of how I will tackle the first simpler bevel cases.

Although I’m realizing that some of the assumptions I made in my proposed schedule are incorrect, I think I’m making good progress and I’m on track. I didn’t expect to have a mostly working interface in the first week. On the other hand, I’m still feeling the race against time a bit, because I know things will come up that will take more time than I think (changing the profiles to be built all at once instead of in symmetrical parts, building ADJ patterns with custom profiles, etc…).

Next Week

By the end of next week I hope to either have my first simple bevel case working, or a more functional drawing of the profile widget completed.


Week 2

(Week 2 Daily Log)

I chose to try to get more bevel cases working instead of working on the drawing widget this week, but it’s the most important piece in the backlog. Here are some things I finished this week:

  1. First visual results for the weld case where there are only two beveled edges connected to a vertex. This case is probably the most important for custom profiles because it’s for uninterrupted beveled edges.

  2. Results for the terminal edge case (in both pictures). The no-mesh version of this case is basically complete.

  3. I structured and mostly implemented code to give the profiles consistent orientations along paths of beveled edges. You can see in the picture below that the profiles are created but they don’t all start from the correct side of the bevel.

I’m also consistently devoting a fair amount of time to my notes document. The part I’m currently working on is the “Passing Along the Choice of BoundVert for Profile Start” section.

Next Week

I plan on finishing my profile orientation regularization code next week. Then I’ll also have to update the two bevel cases I’ve implemented so far to use the new orientation that that process finds. I’m assuming testing it will take a fair amount of time, but if I get lucky with that I’ll start to continue work on the profile drawing widget.

My outlook for the project as a whole is optimistic right now. Once the orientations are consistent and the UI widget is improved a bit, this feature will actually start to be useful.


Week 3

(Week 3 Daily Log)

I spent a lot of time testing and fixing my code to travel around beveled edge paths and give them consistent orientations. I went through quite a few mental models about how this could work and settled on a relatively simple one. The code travels through the beveled edges assigning a start side to the custom profile. If it encounters an vertex with more than 2 beveled edges coming into it it only continues assigning a consistent orientation if it can make a clear choice of which edge will be the most parallel way to continue the path.

The weld case (2 beveled edges) uses the marked orientations now, although I’m still working on the terminal edge case (1 beveled edge). I don’t think the terminal edge case will be very complicated to update, but I didn’t get to it this week.

In my testing this week I also found out that it’s possible to create support loops with a custom profile:

This is interesting because it shows that this feature could be used to implement other bevel features in the future!

Next Week

I’d like to focus almost all of my time on the profile drawing widget next week. It’s frustrating to use at this point because it doesn’t draw properly. I need to convert the drawing to be aware of the non X-Y dependent nature of the profile curve. I expect this to take a fair amount of research and preparation. I hope a week will be enough so that I can get to implementing the >2-way intersection meshes as soon as possible.


Week 4

(Week 4 Daily Log)

Terminal Edge Case’s Orientation

The first thing I did this week was to get the terminal edge bevel case (pictured on the bottom of the object above) to use the profile orientations that the algorithm I worked on last week assigned. With this complete, my test objects work correctly and the feature is starting to become useful!

Building a Custom Widget for Profile Editing

After a while working with the existing CurveMapping curve editor that’s used in many places when a mapping between X and Y values is needed, it became clear that the additional needs of the profile editor shouldn’t be forced into this existing code. The fundamental difference between returning an X and Y position along the profile’s path and the existing code’s “Y value for an input X value” is too important for them to be the same widget. So I spent the majority of my time this week creating a new widget separate from the original CurveMapping code.

The new profile widget complete with a glitchy line through the center

While this new ProfileWidget does have some downsides in terms of code duplication, in the end it will be much simpler for both widgets. Along the way I made some progress saving and opening files with the new custom profiles, and also on the 2D sampling of curves along the inputted profile points.

Next Week

The next item on the list is filling the underside of the profile in the widget with a darker color. I came up with a few methods to do this, the simpler of which is to use existing 2D polygon triangulation code to fill the profile “polygon.” That, along with another more complicated (but maybe more foolproof) method, is described here.

I’d like to at least finish with the widget next week, not including the presets. I’ll hopefully be able to finish fixing the saving and loading of the bevel modifier with custom profiles as well. After that I plan to move on to a special case of the >2-way intersection code pictured below. Mostly as an introduction to the final boss of the >2-way intersection general case.


this might end being one of the few robust functions in Blender

Hm The results are really odd and janky for me with two faces at 90deg angle and on cube the profile doesnt seem to do anything at all. (Albeit I can tell it is doing something because toggling ‘sample only points’ shifts the edges and their number slightly)

Is the blend file for week 3 posts first picture available?

Thanks for testing it!

I wouldn’t expect any results for a cube, because its bevel cases are all vertex meshes, which is the case I just started with. The cases that should work are the ones I’ve pictured so far, the wire case with just 2 of four intersecting edges beveled and the terminal edge case, where only one edge is beveled.

Also, right now the non “Sample only points” case is quite broken too. Also I’ve discovered another bug with loading saved files, but once I fix that I’ll start to distribute blend files.

I’m sorry it’s so buggy right now, I wish it could be perfect already! The only thing I can say is I’m working on it! : )


Week 5

(Week 5 Daily Log)

This week I finished much more than I expected! Here’s an overview of the biggest things I completed:

Profile Widget Fill

I was evaluating two options to fill the profile: First would draw a vertical line for each horizontal pixel and switch its color whenever it hit a line between two points. The other, which I ended up using, uses Blender’s existing polygon triangulation code to transform the profile loop into triangles. It’s been working well so far, and I think it will hold up better when I switch to drawing with the higher resolution curved profile.

Profile Preset Selection

For now the presets are defined in the C code. Eventually I’d like to store the profiles as curve objects, but I’ve finished the UI for the presets and added a few to start off.

Reverse Button

This will be useful when you draw a profile and realize that it’s being created flipped around in the opposite direction that you expected. This image shows the result of the “reverse” button. I found a pretty good icon for it in the sheet, but it will probably need its own.

Initial Custom Profile Vertex Mesh

For the second half of the week I focused on understanding the way vertex meshes are created and enabling them to work with custom profiles. There’s a lot to learn here, and I’ve mostly been reading and making plans, but I have made a bit of visible progress. There’s no ideal solution in cases like these, but there’s plenty of room to improve this in the next few weeks. Here’s a work in progress image:

Next Week

After a lot of confusion, discussion, and planning I’ve made some more concrete plans about how I want to improve the creation of the “vertex mesh” at the intersection of at least three beveled edges. My ideas are a bit scattered about for now, but I’ll collect them in this document in the next day or two. By the end of next week I’d like to have made good progress on this vertex mesh creation. It should be possible to make significant improvement from the smoothed out look they have now.

If I need a break from that I will work on curved sampling of the user placed points that define the profile. I will need to learn a fair amount about Bezier curves for this which should be interesting.


wow :astonished:


Any chance of implementing ‘x’ as hotkey to delete selected point in the curve widget?

Yes, I was thinking of adding X and G (or whatever move and delete are bound to) to the new profile widget and the curve widget.

Yeah, it’s a crazy situation! The bulge in the middle is a remnant of the existing profile function, so expect that to go away, but any intersection like this is going to look strange.


Week 6

(Week 6 Daily Log)

More Vertex Mesh Progress

There was a lot of discussion about vertex mesh creation in DevTalk this week. The takeaway is that I will be targeting two options for this summer: The grid fill method with the existing bevel operator’s ADJ pattern, and the cut-off method which will generate a flat plane at the end of each profile. A boolean option would be ideal, but probably too large of an undertaking for the remaining time in the summer.

This week I mostly finished up the grid fill / ADJ pattern method.

Curved Profile Widget Sampling

Also after a lot of discussion on DevTalk, I added the ability to sample along the profile with any number of points. For the table that’s used for the widget’s display it samples at 256 segments, and for the bevel profile it samples at the input number of segments.
The same code also samples the bevel profile points:
It still needs an option to turn off the sampling of straight edges, but it’s almost there, and it saves a lot of time vs. placing points manually.

Saving and Loading and Memory Leak Fixes

I spent a while cleaning up the DNA structs which store the permanent information for the Profile Widget. In the process I fixed the memory leaks I had introduced the the modifier and the process of saving and loading bevel modifiers with custom profiles. It’s now much more viable to use / test the branch.

Initial Work Towards Custom Profiles in Bevel Tool

It’s an ongoing process, but I made some initial progress towards getting the profile widget in the tool options. I would like the widget to be in the redo panel with the other bevel tool options, but that is proving harder than I expected; I don’t think the redo panel was designed to support that.

Next Week

I’m getting to the point where I can keep track of the rest of my goals for the summer on a relatively short(er) list. So I’ll be working on some combination of these tasks:

  1. Get the profile widget into the bevel tool menu. I need to figure out how to draw in the redo menu or connect the tool menu to the redo menu call.
  2. Cut-off vertex mesh method. The second method as an option for >2-way beveled edge intersections.
  3. Fix profile orientation next to impassable BevVerts. Just a bug that I think might take a bit of time to fix.
  4. Add “harden normals” functionality. Set custom normals for the profile faces using the curvature of the profile.
  5. Fix miter profiles. The miters should still use a normal profile, not a custom one.
  6. Finish RNA API for profile widget. This isn’t strictly necessary for this project, but I shouldn’t add the profile widget without finishing its API.
  7. Documentation and cleanup.

I like the progress so far!

1 Like

Week 7

(Week 7 Daily Log)

Now that I have a mostly working vertex mesh interpolation method, I started working on the backlog of items I had accumulated over the course of the summer. I finished two of the tasks I had and started another.

  • "Sample Straight Edges" Option
    I started off by adding an option for whether or not to sample straight edges. The problem of spreading out the samples evenly in this case is interesting-- one sample is distributed to each point, and then the remaining samples are divided between the remaining curved edges.
  • Custom Profile in Bevel Tool
    I added the custom profile functionality to the Bevel tool, which had been dysfunctional since the start of the summer. It’s great to finally get this finished! I learned a lot about the RNA system in the process, I think the next time I have to do something like this it will be much faster.
  • Fixed Profile Orientation
    The last visible bug (that I’ve found) in the orientation-choosing code is fixed, so that part of the custom profile bevel system should be totally finished.
  • Progress on the “Cut-Off” Vertex Mesh Method
    I’ve added the option to the tool and modifier and laid out the algorithm to create the cut-off vertex method pictured below (courtesy of @CandleComet). This step is probably the most important part of the process. If I’ve thought it through correctly, it should be relatively quick to implement.

Next Week

Next week I plan to finish off the cut-off vertex method, and then get started on the remaining items in my list, most of which remain from last week (6 bigger items remaining!).


Just a note that I’m getting in one more day of work tomorrow so I’m going to post my weekly report after that.


Week 8

(Week 8 Daily Log)

Cutoff Vertex Mesh Method

This past week I mostly spent much more time than I expected implementing the cut-off vertex mesh method. It looks great in most test cases I throw at it now! But there are still some weird edge cases that throw it off. It also currently disables miters which would add quite a lot of arbitrary complexity if they worked alongside cut-off vertex mesh methods.

The whole process was very helpful in getting a better understanding of the process the bevel code goes through to build the vertex meshes. I feel a lot more comfortable working in that area of the code now.

Miters Use Regular Profile

One of the problems with the custom profile calculation was that the miters (arcs and patches between beveled edges) would also use the custom profile. The bevel code now stores a second set of profile coordinates in these cases for the regular profile.


I’d love to have feedback everything here, but on the cut-off method especially at this point. I’ve been expanding a test file with a lot of different cases, so if you’re curious and have a binary of my branch this might be work checking out:

Next Week

The number of larger items in my to do list is dwindling! I’d like to get some feedback on the cutoff method solution and advice to address the edge cases, and I’d also like to finish the “pipe” vertex mesh case which is pictured a couple weeks above. I also have around 40 (!) smaller “TODO” comments in the code that I’m going to start making a concerted effort to reduce.


Week 9

(Week 9 Daily Log)

Progress on Pipe Vertex Mesh

I started off the week by working on implementing my plan for the pipe case vertex mesh, where there are two nearly parallel edges coming into a single vertex. It’s in a very rough state, but the process sparked a lot of good discussion and I’m closer than before.


Work in progress debugging image, just for a sense of what the process is like

Backlog Process

The pipe vertex mesh is turning out to be a complicated problem! So later in the week I spread out my efforts to start to tackle the 58 TODO comments that had accumulated in the code. I’m now down to 21 of them now, which I’m really happy about. Here are some of the more interesting things I finished:

  1. The ability to sample fewer segments from the profile widget than there are control points.
  2. A preview of where the sampled segment locations will be in the profile widget (the smaller dots in the image).
  3. Versioning code for old bevel modifiers without profile widgets.
  4. Cutoff vertex mesh method uses theheight of the transformed profile as it flattens for more obtuse angles.
  5. Cleanup, better readability, and more polish everywhere!

Next Week

The remainder of the TODO items are pretty evenly split between the bevel code and the profile widget. Other than the two items remaining on my list of larger items, harden normals functionality, and finishing the pipe vertex mesh, I’m almost completely in bug fixing mode.

Once I finish the pipe vertex mesh case, I would also like to do a “Call for Content” to gather profile presets from the community!


Week 10

(Week 10 Daily Log)

Custom Profile Pipe Case Finished

After changing my strategy a few times, I’ve finally finished both the 3-way and 4-way pipe case snapping with custom profiles enabled. We can’t just snap to the superellipse function that generates the regular profiles, so instead we do interpolation between the two profiles that make up the vertex mesh. This strategy ensures that every face is a quad and that the profiles are nice and crisp through the vertex mesh.

Backlog Progress

I’ve solved another 14 items on my to do list and I’m now down to just 10. Here are some of the more interesting changes from this process:

  1. Only use the triangle fill vertex mesh method when the extra vertex is not planar with the profile. (939b993600c4)
  2. Don’t use the cutoff method in the pipe case. (33141cff0f4a)
  3. Profile Widget: Dynamic Hi-Res table size. (e38e8f1f7124)
  4. Add shortcuts for moving and deleting control points in profile widget. (e625c5a6b182)
  5. Solved bugs with the profile widget UI and sampling.

Start Harden Normals Functionality Investigation

I’ve started talking to Howard about how to change the custom split normals generation for the custom profiles. The largest change is that there can be sharp edges within the profile which will need split normals. The cut-off vertex mesh method also has sharp edges that will need split normals.

Next Week

Hopefully by the end of next week I will have finished the new harden normals functionality. I also hope to be nearly finished with the remaining bugs on my TODO list. In the next few days I’ll make a public task list for these and link it here. Finishing these two things will set me into the final phase of the project where I’ll work on final polishing, documentation, and figuring out how to move forward in merging this into master.


Week 11

(Week 11 Daily Log)

Profile Sampling Refactor

For the “harden normals” functionality the bevel code needs to sometimes give split normals to sharper profile points, like in this image:

The best way to do that would be to pass through the data about which sample points came from sharp control points and split the normals for those, so I upgraded the sampling code to pass that information through.

Bevel Tool and Modifier UI

After a lot of time and discussion in the DevTalk thread, we’ve settled on some improvements to the bevel’s interface. The biggest change is that the tool and the modifier now share the same layout! It’s a relatively large change but I think it’s an improvement in both situations.

Regularize Profile Orientation Bug Fixing

One bug that’s popped up is inconsistent orientations along chains of bevels. I wrote code a while ago to regularize these orientations, but there are still problems with it. After debugging the old code for a couple days, I got frustrated and rewrote it and I’ve been solving bugs with the new implementation. It’s close to a solution, but there’s still more to fix.

Next Week

I first want to finish solving the profile orientation issue, then I’ll work on harden normals functionality, then documentation and final cleanup. I have a task list here:

I’m going to be gone the week after next, which conflicts with the time a merge would probably happen, but I plan to finish getting this merged into master after that.


the work of finishing the details is even more fascinating, congratulations :clap::clap::clap:

1 Like