Rohan's Bevel GSoC work is now officially in 2.8

https://lists.blender.org/pipermail/bf-blender-cvs/2018-August/112956.html

Download tonight’s buildbot build and enjoy. This should include the bevel weighting and the other enhancements. I don’t know if this yet includes the custom normals work which is probably a different branch.

Congratulations to the student for getting up to 2 years of work made official :sunny:

12 Likes

Not sure about custom normals either. Nice work though, Rohan, HowardT and co.

1 Like

I spotted the custom normals modifier. Seems like all is there…yeah! :heart_eyes:
Thanks Rohan for your hard work.

I tried yesterday but can’t get it to work, the modifiers are there but the weighted normals doesn’t do a thing, neither the bevel normals options, also the normals menu options are all greyed out.

This is such a leap! :slight_smile: Thanks Rohan, you are the man!
There still seem to be some bugs/crashes though, not only in combination with the boolean modifier.

Did you try to activate “autosmooth” in the Data tab of the mesh ? Thats needed.

3 Likes

Just accidentally stumbled upon these. My god these is amazing!

Although it does crash a lot.

Oh silly me, that must be it. I’ll check tomorrow. Cheers

1 Like

Anyone have a quick rundown of what was changed/added by the various projects over the years that were included in this commit?

2 Likes

Rohans last years GSOC added the “weighted normal” modifier which basically is a non-destructive replacement for the YAVNE addon. straightened normals are interesting for game content creators.
(starcitizens deferred decal rendering pipeline depends on such.)

This years GSOC adds such functionality to the bevel modifier itself, so you dont have to stack a weighted normals modifier ontop everytime.

Plus other related additions:
(text copied from Rohans Devtalk thread)

  • Current bevel-2018 branch contains my previous years branch as well (Although current 2.8 has some odd behaviour with normals)

  • Fixed edge data of beveled edges. Added an option to the modifier and tool. Press K to extend sharp edges and U to extend seams onto beveled edges.

  • Added profile support to in plane vertex bevel
    plane_vertex_profile

  • Added option to harden normals in tool and modifier. Has similar functionality to the WN modifier yet is not an exact copy (given how wn mod is infinitely more complex). Instead of sorting according to face weights and using an inverse exponential weighting mechanic, I’ved used normal strength which determines final normal to achieve similar shading, still may have some differences so please let me know.
    Things to note: Respects sharp edges by default
    Normals of beveled edges in the tool aren’t influenced by adjacent unbeveled faces. (If edge of cube is beveled then normal of 3rd face not taking part in bevel is ignored)
    Haven’t really added a fixed method to have all normals of vertex in reconstructed face point to face normal but are computed right now. Can add this (as an option?). Don’t want to clutter bevel with options though.

  • Added functionality to select a face influence for the beveled faces to be used in the WN modifier, exposed in the UI. Sets the face influence to currently selected in normal tools > face strength.

  • Wrote methods to fix shading continuity. There are cases when beveling creates a ring mesh which appears to have aberrant shading with large number of segments. This method aggregates the edge normal data to create smooth shading.

I am curious for user opinions on how the hardening in the Bevel tool and Modifier works after merging in this GSoC project. I wrote this on devtalk but will repeat here for a different audience:

Consider this diagram:

Now if a user wants to “harden normals”, I believe this means that the “per-vertex-face-normals” (aka “Loop normals”) at a, b, c, d, e, f need to be set according to some rule that in general leaves the big faces like A as looking flat at the junction between those faces and the newly-created bevel geometry. But this leaves some questions about what happens elsewhere in the model.

Here’s what I think the new per-vertex-face-normals should be; in some cases, there are questions. These all assume that the normals have all been “split” so that there are custom normals for each face/vertex pair. (If this isn’t true already, the harden-normal option should cause that as a side effect, do people agree?)

a - pre-existing custom normal (probably A’s face normal, but user might have edited it – if the whole object was desired to be smoothed then it may be the vertex normal at vertex a)

b - pre-existing custom normal? or A’s face normal? or (some kind of) average normal between A and bottom face if pre-existing custom normal was the vertex normal for the original front lower cube vertex? My best guess: if pre-existing custom normal is not A’s face normal then angle-weighted average of the faces around be that are not part of the newly created geometry for edges and vertices.

c, d, e - face normal of A. (But what if original edge that created bevel face A were marked “sharp”? Should we then use D face formal for d and C face normal for E and who knows what for f?)

f - vertex normal of vertex at f (i.e., angle-weighted average of normals of face C and other 3 faces around f)? What if faces are not smooth shaded – should bevels be faceted (that is, should we be using C’s face normal)? My best guess: no.

If the answers to the above questions are clear, then there are too many options for the bevel harden normals right now (e.g., I don’t think the “face strength” and “vertex average vs face mode” of hardening are necessary, nor the “fix shading” mode that frankly I am not sure what it does. If the answers are not clear, what options should there be?

And what if the user wants to have bevel affect “Face Strength” (Weak, Medium, Strong) so that a Weighted Normal Modifier can use it later? Should that be done instead of or in addition to normal adjustments (my best guess: instead of). And would it be sufficient to just set the “Face Strength” of all of the newly created geometry for edges and vertices (highlighted in the diagram above) to get strength “Weak”, or are more options needed?

I realize that in beta we probably shouldn’t be changing much, but I think the current code and options are pretty confusing. What do other users think. I also don’t want to break too much if users are already using the options as they exist in 2.8 and would miss any if I took them away (e.g., do people find the ‘fix shading’ mode does good things for them?)

First of all a bit of a quick background. I work as an artist on Star Citizen which is one of the games that popularized using custom vertex normals for hard surface models. I haven’t used the new bevel modifier much but have used the older weighted normals options a fair bit and at one point I made a script similar to YAVNE for Blender so I have some experience with this stuff.

Sounds reasonable assuming that this won’t result in actually split vertices for when the mesh gets exported to a game engine (assuming there’s no material/UV splits/shading or anything else on the edge in question). If they were split anyway unnecessarily it could quickly add up in a game-engine, as (I’m sure you’re aware) that would result in an additional vertex for each split normal and there’s a limit of how many vertices you can bring in per model.

Yeah, just go with the normal of face A for a and b.

Sounds reasonable. The only solution I disagree with is the f one. Vertex f should be aligned to the edge normal (probably not an actual thing but hopefully you catch my drift) of face B’s right edge. What I mean here is that normals for the vertices of the edge bevels still need to be a bent plane (in one axis) otherwise things won’t look right. The normal for vertex f and the corresponding vertex on the other side should be parallel if at all possible.

I’m not really sure what the different methods do, I’ve mostly used Face Area and Vertex Average in the past (as far as I remember, don’t have access to those files at the moment). I did a quick test on a cube with Fix Shading and I’m not sure what it’s supposed to do but it didn’t really do what I expected.

I think it’d be good if the Normal Strength slider could just default to 1 (the custom normal option is turned off by default anyway so it wouldn’t change anything). It’d be good if auto-smooth could be turned on by default as well as it’s a little tedious to go in and adjust it every time, but I know that’s not really your area.

Here’s how I would approach the issue (using one of your old images to illustrate):

If you take this mesh, select all the boundary edges between the different materials and set them to sharp (and smooth shading on the whole object), you will get the desired normals (albeit with hard boundaries). The next step would be work out how to prioritize which normals to actually use on the boundaries to make sure they transition smoothly. I’d do that like this:

  1. Green (original faces)
  2. Blue (bevelled edges)
  3. Pink (bevelled corners)

Then the last step should just be to replace the normal of all the boundary vertices with the one from the other facecorner-vertex (in the same position) with the highest corresponding face priority you can find (green first, then blue, then pink). Every non-boundary vert could just use the original averaged normals as they shouldn’t need to be modified further (could be wrong).

I hope that makes sense, it’s a pretty complex subject so I’d be more than happy to clarify anything you want.

1 Like

Thanks very much for the detailed response. Especially appreciated from someone with your experience in this area.

Splitting the normals won’t split the vertices in Blender. I don’t know for sure if any of the exporters might split them on export if they have split normals.

I agree with you on the f case. And understand and agree with what you were saying in the last section, about the color priorities. But for b, you said use A’s face normal. What if the edge a-b is smooth? This might happen if face A and the face on the bottom are smooth shaded, and more likely that an artist might want the edge to be smooth shaded if the angle between A and the bottom is more obtuse. I think perhaps in that case b’s normal should be the edge normal of edge a-b. What do you think?

Thanks again.

As long as the normals are perfectly aligned for all the face-corner vertices it shouldn’t be a problem but it might be worth going in at some point to make sure that’s the case.

If the edge would be smooth between edge a-b that always tends to look horrible at least with the solution we’re using at the studio (which is for Max to be clear), but I think I know what you mean. It always looks terrible because the angle between these faces would just be too big, so I don’t know if there is a good solution to something like that. It’s similar to the issue of the default smooth shading looking horrible on the default cube, as there’s just not enough information to make it look decent
.
If I were modelling an object like that I’d just put a bevel along that bottom edge so there’d be enough data there to make a proper smooth edge. If I couldn’t do that for some reason (maybe it’s a modular environment piece or something like that) I’d make the edge sharp instead without any bevel and then both sides should be simple enough to fix, as you’d end up with split vertices with their own normals on either side of the edge.

What you may be asking about might be more akin to the curved side on the coloured cube posted above where the plane-shift is a lot subtler. For that I’d calculate the normals as if they were split off on their own again (like I described earlier with the material boundary edge-splits) and just use the averaged normal you’d get from that and then replace the normals on the adjacent faces face-corner vertices like I described to make the groups blend together smoothly…

Again hopefully this makes some sense to people that aren’t me. I could probably make some simple pictures explaining it otherwise. Also thanks for reaching out to the community for feedback, Howard!

Thanks for the reply again.
I agree that it would be bad to make a-b smooth, but in some sense I should obey the wishes of the user: if they mark both the side and bottom face as ‘smooth’, then who am I to argue? As you say, most would not in that case, but might in the case of the curved side of the colored cube.

I think I have enough to go on now to try an implementation that is like what you describe. Thanks for your help.

I forgot to mention one thing that can be done to fix faces that are smoothed over more extreme angles like those two cube faces you mentioned. As I said if it’s going to be somewhat visible it needs a hard edge or a bevel, but if one of these faces is only barely visible you could get away with some dirtier solutions.

In the studio we set up all our custom normals using a similar system to the face-groups with different prioritizations that Rohan sat up on my request. With this system you could assign more prioritization on the more important face so it’d look good and then the other face would look really weirdly smoothed but it would work and would be slightly cheaper than a hard edge or bevel. I would show you a picture of what I mean, but I can’t get 2.79 to work on my craptop (I’m not at home) and I can’t get it to work in 2.80 (which somehow just works on this computer).

I found the Mesh>Normals>Set Strength function but I couldn’t figure out how to use it as there was zero feedback after clicking it. I would expect the dropdown menu Rohan made to be under the Object Data>Normals, but maybe that’s been moved elsewhere. This semi-solution was more related to the weighted normals modifier than the bevel modifier so maybe it’s an unnecessary aside. My point was mostly that it’s not necessarily something that needs (or should) be fixed within the bevel modifier.

The “face strength” thing is there, and used by the weighted normal modifier, but is is very awkward to use. As you say, zero feedback after using it. And very non-discoverable: the strength that you will set with Mesh>Normals>Set Strength is found in the properties panel, under the “Active Tool and Workspace Setting”, and then the Normals section:

34%20AM

(That’s also where you will find the normal value if you do Mesh>Normals>Copy after doing the dance of selecting first a vertex and then a face when in Vertex+Face multiselection mode).

This is just where stuff ended up with the default port of operators to 2.8. I would like to work on fixing this to be a better interface, but first things first – fixing the bevel hardening.

But speaking of bevel again: there is a ‘Face Strength’ checkbox for the bevel modifier and tool, which says to set the Face Strength when the bevel code runs. What should that do, in your opinion? Given your diagram of a few posts ago, I guess you would like the green faces Strong, the blue faces Medium, and the pink faces Weak. Is that right? What about the faces not involved in bevel at all – should they be just left alone, or all set to Strong?

Oh, right I see how it works now. I definitely agree the workflow for that could be smoothed out a lot. I’d move the strengths under the mesh data>normals as I said and maybe just have them all displayed at all times in that submenu like this:
Custom Normal Normal Face Groups:
Weak: Assign, Select
Medium: Assign, Select
Strong: Assign, Select

In 2.79 it was always a bit tedious to have these as a dropdown menu as it created an additional click every time you needed to change them, even if it did save some space.
Alternatively they could be combined with the new Face Map functionality as I understand that’s basically just Vertex Groups but for faces (with some additional functionality on top).

I’m glad I’ve not needed to do that as that’s too unintuitive for someone to figure out on their own.

I’d say it’s probably better to leave uninvolved faces alone so you can set up the normal facegroups manually and then place one or more instances of booleans and bevel modifiers on top of that with a WN modifier at the very end fix the shading. In fact it might be best to have an option to just assign new values to the new faces created (excluding the green faces above altogether) in order to limit the potential for damaging the rest of the mesh (otherwise if you make a cutout into one of the bevelled sides of that cube we were talking about you would get undesired results).

Thanks for your reply, Nossiak.
I like the idea of just using a cascading menu to assign face strength.
Thanks for your input on face strength assignment in bevel.

@howardt great to hear that you are working on this, as the workflow does need some love!

I would love to see some buttons added in the properties panel under where you can select the normals>face strength. If there were 2 buttons here for face strength and face select it would more closely mimic the yavne addon for 2.79 (which is close to perfection). Currently I am adding these operations to the quick menu, but they should be added to the properties panel.

Have also been wondering how to use sharp edges in conjunction with the weighted normals modifier? The only way I have found is to mark edges as sharp and then use the edge split modifier (with just the sharp edges option on) before the weighted normals modifier.

With the yavne addon you could tag edges as sharp and then update the vertex normals with the addon. This kept sharp edges as a normals modification rather than having to spit actual faces from your mesh, which is a bit hacky.

Where can I read on what this does exactly? :slight_smile: