GSoC 2019: Bevel Profiles Weekly Reports

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! : )

3 Likes

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.

17 Likes

wow :astonished:

4 Likes

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.

2 Likes

Week 6

(Week 6 Daily Log)

More Vertex Mesh Progress

(8f2861c215c2)
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

(625a3a113a68)
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.
Screenshot%20from%202019-07-06%2000-40-03
The same code also samples the bevel profile points:
Screenshot%20from%202019-07-06%2000-45-51
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

(aa48aca0a7e3)
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.
13 Likes

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.
    image

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!).

9 Likes

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.

3 Likes

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.

Testing

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: https://developer.blender.org/F7621266

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.

6 Likes

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.

Screenshot%20from%202019-06-19%2010-17-57


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!

10 Likes

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.

14 Likes

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:

https://developer.blender.org/T68330

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.

15 Likes

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

1 Like

I gotta repeat one more time that I’m impressed by the quality of your work, your attention to detail and the quality of your communication. Not to mention we all get to play with this great tool thanks to you. Mad props !

Hadrien

1 Like

Week 12

(Week 12 Daily Log)

Patch Submitted!

There are still some remaining tasks to do, but having the patch submitted and possibly starting the review process is a great first step in the merging process. I’ll add some pictures to that diff and update it as I fix the few remaining bugs.

Presets


Here is the selection of presets that I’ve added so far. I’ve asked for others ideas on the other thread, so if you have input head over here.

Profile Orientation Regularization Fixed!

I finally got this working! After so much frustration and a lot of time, I found all the errors I had made writing the new version, and eventually ported those changes back to the original version which I think is faster.

Bevel Modal Keymap

Added Z for custom profile and N for intersection method toggling. I find the bevel modal keymap overwhelming, but for people who use it frequently this should be helpful.

Miscellaneous Bugs and Smaller Features

  • Even length sampling option
  • Small UI updates
  • Code and comments polish
  • Sampling bug fixed: extra samples are now assigned properly to the most curved edges

Next Week

Over the next five or six days I’m going to be totally off of the internet on a hiking trip. I’m hoping to have some feedback on the patch I posted when I get back. But I’ll have to finish up and submit my final report as soon as I get back too. This means that the merge into master will have to wait until after the official end of GSoC.

I may post again with my final report, and obviously I’ll continue updating people as I continue the project and development in the fall, but I want to thank everyone that’s participated in the project for the awesome amount of support. You all made this project from a cool intellectual challenge into a passion for me, it has been a great experience!

17 Likes

This looks very amazing!

1 Like

you can already use it, just load recent Blender 2.82Alpha, AFAIK it was in master from some days

1 Like

@Artturi Please check this thread out:

This thread can be closed because CSoC2019 is over, right?

I believe we thought it would be best if we left it open for now for reference. But eventually it may be taken down.