Creation of rectangle with rounded corners

Hi there,

I am trying to create in Hitfilm Pro a rectangle with rounded corners.

I found a way to create a rectangle shaped mask and round the corners, however the overall object will round, whereas I just want the corners to be rounded.

Does anybody have a solution?

Rectangle with rounded corners


  • CervierCervier Website User Posts: 156 Just Starting Out
    edited September 2019

     When trying to achieve that result last year, the only way I could figure out uses 6 masks: a circle for each corner and two rectangles to fill.

    I start by drawing a rectangular mask that has he shape I'm aiming for (except for the corners, of course). Putting the mouse cursor on the upper left corner and pressing SHIFT, I draw a circular mask inside the rectangle. I duplicate that circular mask 3 times (press CTRL + D three times). I select one of the duplicates and bring it down into the lower right corner. I rename it "Lower Right", open its properties/transform and note its position (let's call the coordinates Xright and Ylow).

    Then, I select another duplicate, rename it "Lower Left", go to its position, leave the X value as 0 but write in Ylow as the new Y.

    I select the last duplicate, rename it "Upper Right", set its position to Xright, leave Y as 0.

    I Rename the fist circular mask to "Upper Left".

    Now, I draw a rectangular mask from the top of the Upper Left circle down to the bottom of the Lower Right one. Finaly, I draw a rectangle mask from the "9 o'clock" of the Upper Left circle down to the "3 o'clock" of the Lower Right.

    That's 7 masks (all set to "Add" by the way), I hear you say. Yes, but we can delete the very first one, that's 6 and we're done.

    [LAST MINUTE EDIT] While re-doing that procedure to remind myself of the various steps, I found a way (duh!) that makes drawing the two rectangles easier, faster and more precise... Duplicate the very first rectangle and uncheck it so you can see the circles. Select the other one and using the mouse, drag the top handle down until the horizontal edges of the rectangle are aligned with the horizontal diameters of the circles. Check and select the other rectangle and drag in one of the side handles, until the vertical sides are aligned with the vertical diameters of the circles.

  • AxelWilkinsonAxelWilkinson Staff Administrator, Imerge Beta Tester, HitFilm Beta Tester Posts: 5,247 Staff

    Create a rectangle.
    Add a large blur. this rounds the corners through the gradient.
    Add a threshold effect. This removes the gradient and gives you a hard edge again.

    The radius of the blur will control the corner radius, and the threshold value will define where within the gradient of the blur the edge falls. I learned this technique for image editing years ago, but I juste tested it in HitFilm and it works. I used a rectangle mask on a colored plane, with a black plane beneath it, and then applied the threshold to a grade layer above them.

  • FilmSenseiFilmSensei Moderator, Website User, Ambassador Posts: 2,538 Ambassador

     @AxelWilkinson That's a really neat little trick!

  • NormanPCNNormanPCN Website User Posts: 4,014 Enthusiast

     We still need a round rectangle for use with Neon Path. Doing that manually with mask paths is really, really tedious to get all corner symmetric. The human eye really triggers on asymmetry. After a while you just give up.

    I just don't get all the gymnastics techniques to do something as simple, and industry common, as a round corner rectangle. There is a real resistance here.

  • DannyDevDannyDev Staff Administrator, HitFilm Beta Tester Posts: 338 Staff


    It's not resistance. It's limited resources and priority. We are a small team and must focus our resources on what's important.

  • DimipapaDimipapa Website User Posts: 320 Enthusiast
    edited September 2019

    I use the square mask, create the shape then expand the mask

  • CervierCervier Website User Posts: 156 Just Starting Out

    Dimipapa Nice! So simple! The "Expansion" is the radius of the corners, which makes it easy to have consistent radius on different rectangles. The tricky part would be to draw a rectangle with the desired width and length and round its corners to a desired radius. It requires to draw a mask whose width and length both have been reduced by "Radius" pixels.

    This can be done by drawing a mask of the desired W & L, "Expanding" it by -Radius, drawing another mask on that new rectangle and expanding that new mask by +Radius. And getting rid of the first mask that's not needed anymore.

    Of course, that's just in case precise dimensions are required, as it was the case for a former project of mine that made me come up with the tedious method I described.

    Thanks Dimipapa

    AxelWilkinson Clever trick! It helped me understand better the effect you used, thanks.

  • FilmSenseiFilmSensei Moderator, Website User, Ambassador Posts: 2,538 Ambassador

    I know a way to do this and get an exact measurement using a set matte effect...

    • Set up a new composite shot
    • Add a new plane that is the exact size that you want the rounded corner rectangle to be (or alternatively, use a full sized plane that you simply adjust the scale) - call this plane "Matte" and make it invisible
    • Add another new plane that is the size of the frame
    • Fill color that plane white
    • Drag another black plane under that one
    • Put the "Matte" plane on the bottom
    • Add a set matte effect to the white plane and source the "Matte" plane
    • Add a blur effect to the white plan
    • Add a grade layer on the top of the stack
    • Drag the threshold effect into the grad layer

    The amount of blur will dictate the corners, and the size of the rectangle will match the size of the "Matte" plane. Adjust the size of that plane to change the size of the rounded corner rectangle. This will result in a perfectly sized rounded corner rectangle down to the exact pixel!

  • iviapricotiviapricot Website User Posts: 4

     This is great!

    Thanks a lot

    This little community is such a great help!

    Amazing, thank you all 

  • FilmSenseiFilmSensei Moderator, Website User, Ambassador Posts: 2,538 Ambassador

    @iviapricot I made a quick, five minute  video tutorial on this topic which will release on Friday morning at 9 am Eastern / 6 am Pacific. I will post a link of it to this thread when it goes public.

  • FilmSenseiFilmSensei Moderator, Website User, Ambassador Posts: 2,538 Ambassador
    edited September 2019

    @iviapricot As promised, here is the tutorial...

  • graemeallangraemeallan Website User Posts: 7

    Useful thanks!

    Seems a shame there can't be a bit of time devoted to adding a slider to the rectangle mask tool though...

  • TheBenNorrisTheBenNorris Staff Administrator, Website User, Imerge Beta Tester, HitFilm Beta Tester Posts: 1,664 Staff

    @graemeallan it isn't just as simple as "adding a slider". If this is a feature you want, then I highly recommend you add it to the wishlist so that we can more easily see it when it comes to reviewing features we intend to work on in upcoming versions, thank you.

Sign In or Register to comment.