Home Technical Talk

How can i revert a chamferd edge?

interpolator
Offline / Send Message
SimonT interpolator
Hi guys!

Searched the forum & google but didn't found what i want to know. Ok, here is the question:

How can i revert a chamfered edge? (3ds max)

Example image below. I chamfer this edge and maybe some hours later i think: "Hm, this edge is annoying, i want to have the original state of the model here!". Ok, i could just loop-select the lower edge, bring it to the same height as the top of the "box" and then delete the inner part of the top...but is there no way to just select some edges and click one button and *swup* all is fine as before?

polycount-chamfer.jpg

Replies

  • DarthNater
    Offline / Send Message
    DarthNater polycounter lvl 10
    I usually just either weld, or target weld the verts. Then make sure you align the verts on their axis in case anything got moved.
  • Mark Dygert
    1) Select a vertical edge in the newly chamfered section, click ring, click collapse.
    Probably need to click each vertical edge and make planar to straighten them out as it might slope the sides.
    Doing it this way is most friendly to your UV's, unlike welding which is time consuming and destructive to UV's.

    2) Symmetry on the Z axis, so the bottom is mirrored to the top, remove the center seam.
    It will mirror your UV's also, the easy fix is to flip half and weld it before you remove the center seam.

    3) Delete the top poly and the chamfered polys, select the boarder, cap it and drag it up a bit to match the height.
    The new cap will have fugly UV's, but nothing quick planar map won't fix.


    Probably a few other ways to get it done too...
  • DarthNater
    Offline / Send Message
    DarthNater polycounter lvl 10
    Wow, thanks Vig, number 1 sounds a lot easier than my suggestion haha
  • SimonT
    Offline / Send Message
    SimonT interpolator
    Thanks for the tips but the goal is, just remove the chamfered edge without changing the position or orientation of the other edges/verts.

    I mean, the manual steps to do this are pretty simple - can't imagine there is no script for it...
  • Mark Dygert
    Kudos to who ever can pull it off. I don't think the manual way is all that hard.

    It's probably not so easy to figure out where an edge was or where the two edges would intersect? Then collapse the chamfer back down to a single edge and move it back to that point. Add to it that there are probably all kinds of odd case situations that could dork it out. It sounds like a scripting nightmare...

    I'm not a big fan of wizard like tools, they aren't all that reliable. They normally work great for specific things like this example but but aren't swiss army knives and ultimately fail on other things. If it takes longer to try it out and find out it failed than to do it manually I'd rather do it manually.
  • DarthNater
    Offline / Send Message
    DarthNater polycounter lvl 10
    Vig wrote: »
    Kudos to who ever can pull it off. I don't think the manual way is all that hard.

    I hate scripts also, but I think a simple chamfer like this wouldn't be too hard to fix. I shouldn't say that because I've never messed with it and I haven't programmed in about a year, but here is my logic behind it:

    Basically 'extend the top surface poly out over the edge, and extend the side poly also and where those two intersect, the new (old) edge should go. This would probably get way harder than this with advanced chamfering, but something like this 1 chamfer shouldn't be too hard to script?
  • SimonT
    Offline / Send Message
    SimonT interpolator
    Will be more complex i think because it should also work when your model was rotated or something like that. Maybe it could be possible if you use the normals of the verts in combination with the parent normals.

    For me it would a really great time saver because correcting a lot big bended polygons is annoying and time consuming if you do it more than 1x a day.
  • divi
    Offline / Send Message
    divi polycounter lvl 12
    add a line to the edge ring the chamfer created and extrude that with a large base width and for the height you'll have to mess around a bit. weld all the vertices with a small value. it's not 100% accurate unless you figure out which formula you'd have to use based on the chamfer amount, but when it comes to math im stupid. deleting the chamfer and moving the edges up/connecting them is more accurate for simple examples like yours, but the extrude thingie also works for stuff thats not straight or rotated. not for everything, but in most cases you'll get away with the slight angle changes on the faces.
  • mLichy
    maybe illusion catalyst will come up with something... ;)
  • CrazyButcher
    Offline / Send Message
    CrazyButcher polycounter lvl 18
    hm, at last and first vertex of a chamfer vertex pair/series (say top and bottom for simple 1 poly between) you generate a plane whose normal is made from all connected non-chamfer polygons.
    that gives you 2 planes that intersect at a line on which our "old vertex" should be.

    then intersect that line with a plane that is created from the edge that connects the vertices and its normal is created from the 2 (or 1) polygon shared of that edge.

    move top and bottom vert there, weld and delete the polys between.
    thats the theory.
  • MoP
    Offline / Send Message
    MoP polycounter lvl 18
    DarthNater's suggestion (which is also what CrazyButher is saying, I think) is exactly what one of our guys did for our internal tools, a Python script for Maya called "Unbevel", which reverts the geometry back to the original shape and preserves volume. It works in 99% of cases, but unfortunately I don't have the rights to share it :/
  • ZacD
    Offline / Send Message
    ZacD ngon master
    Damn studios and all their cool internal tools.
  • SimonT
    Offline / Send Message
    SimonT interpolator
    @MoP

    Do you have right to say how your programmer solved the problem?
  • Ark
    Offline / Send Message
    Ark polycounter lvl 11
    Seneca Menard wrote a script for modo called 'unbevel' that does what you want : http://www.indigosm.com/modoscripts.htm

    Maybe you could look at the script and try to construct your own for max?
  • DarthNater
    Offline / Send Message
    DarthNater polycounter lvl 10
    Damn guys maybe I should put my useless programming knowledge to good use and try to do this for Max...... I'll see what I can come up with, but I think this is going to be a big feat for my first script hehe.
  • MoP
    Offline / Send Message
    MoP polycounter lvl 18
    SimonT, like I said, it's basically what CrazyButcher and DarthNater already described.
  • pior
    Offline / Send Message
    pior grand marshal polycounter
    Any progress? Either for Max or Maya ....
  • DarthNater
    Offline / Send Message
    DarthNater polycounter lvl 10
    Poir, I am actually working on this in my free time. I'm quickly learning max script (its actually pretty damn easy...once you find the correct areas on Tech-Artists (Keep your mouth shut MoP :P)). But once I actually get something worth showing, I'll let you guys know. ;0
  • SimonT
    Offline / Send Message
    SimonT interpolator
    i'm talking to programmers sometimes and ask for a mathematical solution. but i'm not that good in math so it will take time. also i don't can spend so much freetime sparetime in this. but maybe it will be successful in the future.
  • CodeFather
    Offline / Send Message
    CodeFather polycounter lvl 15
    I would use IllusionCatalyst ExtendSurface feature and then clean the old loops.

    surfaceexpandtrick.jpg
  • DarthNater
    Offline / Send Message
    DarthNater polycounter lvl 10
    Codefather, that's exactly how I have my script laid out on paper, just want it to happen in 1 step. My thoughts were this:

    1. Select the edges of the chamfer (just the outter most ones if you have a higher value of chamfers)
    2. Delete all geometry in between selected edges.
    3. Extend edges that were selected.
    4. Weld verts.

    I'm actually going to try this as soon as I finish a prop I'm working on (should be tonight).
  • Bryan Cavett
    Offline / Send Message
    Bryan Cavett polycounter lvl 19
    I have a working version of this I can clean up and post here. It basically works the same as Seneca's Modo script using a linelineintersect function found on cgtalk http://forums.cgsociety.org/showpost.php?p=3398267&postcount=3

    It's not as quick to clean up the top portion of the mesh pictured in the first post but cleaning up the sides is fine. You select the edges that make up the bevel and run the script but it needs an edge on both sides of the bevel. So say for the top you would have to cut the top across to get another edge to run the script or you will not get an accurate placement of the collapsed verts. I'll see what I can come up with soon.

    Edit: I also need to make it work on multiple edge rows. Currently you have to select each edge loop that has a bevel and run it... need to find a way to sort out each edge loop you have selected and then run the function on it.
  • Bryan Cavett
    Offline / Send Message
    Bryan Cavett polycounter lvl 19
    Ok guys give this a shot http://www.bryancavett.com/maxscripts/unbevel.ms

    Should show up under the category "BCTools" I'm sure there are bugs and if anyone wants to take it further then go right ahead.

    The sides work perfect but...
    unbevel_01.gif

    You can see here how the top is still a pain. Would probably need a different algorithm for that where you just select the ring and hit a button. Thats beyond me though.
    unbevel_02.gif
  • DarthNater
    Offline / Send Message
    DarthNater polycounter lvl 10
    Hey thanks! Ill have a look at this and see if I can fix it up(ill have to run it a few times, I don't see what's wrong with it haha).

    Edit: Nevermind now I see what you mean, my phone wasn't animating your images :P
  • DarthNater
    Offline / Send Message
    DarthNater polycounter lvl 10
    Ark wrote: »
    Seneca Menard wrote a script for modo called 'unbevel' that does what you want : http://www.indigosm.com/modoscripts.htm

    Maybe you could look at the script and try to construct your own for max?

    Good lord, I just glanced over that code and it's rough. Not the coders fault though haha.

    Bryan, you're script does things a little differently than I'd like so I'm not going to use it, but it's good none the less!
  • mLichy
    I tried running that un bevel script, but it did nothing? Maybe I was selecting the edges wrong somehow?

    I would also VERY much appreciate a script like this.
  • Bryan Cavett
    Offline / Send Message
    Bryan Cavett polycounter lvl 19
    mLichy: It needs to be an open edge loop. Basically you select the edges you want to unbevel and then one more on each side and run the script. It uses the end edges to get their intersection point . If that's' not the problem then there's a bug

    Here's Seneca's explanation of his script... mine works just the same. I should probably put a pop up window in if you have a closed loop
    unbevel_instructions.png
  • mLichy
    ooooh, ok. I'll give that a shot. Thanks for the shiny picture


    Edit: Yeah that works great :). Now just if someone could somehow do the same for the top of the box, that would be epic :D
  • pior
    Offline / Send Message
    pior grand marshal polycounter
    BC : for the top part of that example box still causing issues, what about some sort of projection technique. User selects the edges to 'expand', then selects the desired receiving face, and bam the top verts of the selected edges get projected on the plane of reference defined by the top face. The rest is just a matter of removing the undesired edges now part of the reference plane.

    Also I noticed that scaling edges locally naturally create that 'expansion' effect - meaning the axis of projection should be easily readable?

    Scripts looking great so far, trying it out first thing tomorrow!
  • DarthNater
    Offline / Send Message
    DarthNater polycounter lvl 10
    AAAAAHHHHHHHHH I forgot how much I hate vectors and all this 3d math! HAHA.

    I think I know why it's not working on the top chamfers, I think it has to do with the order in which things are being done in the Linelineintersect function. I'm going to try to write a function that checks the faces normal direction and then reorders that function if the surface normal is facing in the positive z direction. Unless someone gets to it before I do (hence why I posted this here haha).
  • Bryan Cavett
    Offline / Send Message
    Bryan Cavett polycounter lvl 19
    Pior: Yes I thought of that as well but it would only work if the top poly had a perfect normal for the operation. If say the top poly or polys were capping a very curved surface then you would be projecting to some averaged normal plane and it would not work in all instance.


    DarthNater: If your only checking for a positive z normal then it will only work if the top part of the bevel/chamfer is facing up. What if you want to get rid of the bevel and that particular object is rotated 90 degrees... or 47.8 degrees?


    I think there's another way of taking care of the top. I'll see if I can get it to work. I have an idea but knowing which edges to use as the vector and which point to project onto that vector may require the user to select the top poly or polys so I could test and see which vert is the correct end vert.
  • DarthNater
    Offline / Send Message
    DarthNater polycounter lvl 10
    Well I should say check for ANY z direction. I can't open max right now but if you take that same box, rotate like 3 degrees in the z direction and try to run your script on that side that used to work, does it still work? I'm thinking we need a new function for any faces that have any z direction...
  • carlo_c
    Really handy script, I've always wanted a feature like this in max :) Thanks for making it happen.
  • Bryan Cavett
    Offline / Send Message
    Bryan Cavett polycounter lvl 19
    Darth: My script should work at any rotation or scale. Atleast it did in all the tests I've done with it.
  • DarthNater
    Offline / Send Message
    DarthNater polycounter lvl 10
    Im lost now, then why isn't it working on the top? lol
  • Bryan Cavett
    Offline / Send Message
    Bryan Cavett polycounter lvl 19
    My script doesn't work on the top because it requires you to have edges on the outside of the bevel'd edges. Since the top is capped and does not have edges my script does not know how to get the original position of the corner vert. It doesn't have the second edge(vector) to use to the get the intersection point. You could inset the top poly and then you would have the extra edge you need to use my script.
  • DarthNater
    Offline / Send Message
    DarthNater polycounter lvl 10
    My script doesn't work on the top because it requires you to have edges on the outside of the bevel'd edges. Since the top is capped and does not have edges my script does not know how to get the original position of the corner vert. It doesn't have the second edge(vector) to use to the get the intersection point. You could inset the top poly and then you would have the extra edge you need to use my script.

    Ah gotcha. Sorry, I'm a little (OK VERY) rusty, haven't used my 'technical' brain for at least a year now :P
  • Bryan Cavett
    Offline / Send Message
    Bryan Cavett polycounter lvl 19
    I realized that I gave a horrible example of how to clean up the top portion of the model in my original post. Here is a better way to take care of it with my script. Its not much more work... just inset to get the extra edge needed.

    unbevel_03.gif
Sign In or Register to comment.