Search Unity

How rounded corners edge are made in csgo game

Discussion in 'General Graphics' started by AlanMattano, May 10, 2019.

  1. AlanMattano

    AlanMattano

    Joined:
    Aug 22, 2013
    Posts:
    1,030
    How rounded corners edge are made in CSGO game?
    Is it in the model or is a shader function that makes that effect?


    dust2.jpg


     
    Last edited: May 10, 2019
  2. TenKHoursDev

    TenKHoursDev

    Joined:
    Nov 9, 2014
    Posts:
    985
    Its called a bevel. There are functions within Blender and every conceivable 3d modeling software package to create bevels or smooth subdivisions.

    Blender recently added a shader that smooths sharp edges without introducing additional geometry though.
     
    AlanMattano likes this.
  3. BIGTIMEMASTER

    BIGTIMEMASTER

    Joined:
    Jun 1, 2017
    Posts:
    2,115
    Last edited: May 11, 2019
  4. AlanMattano

    AlanMattano

    Joined:
    Aug 22, 2013
    Posts:
    1,030
    Thanks, @BIGTIMEMASTER for the vertex link. That was what I was looking for. I was able to presume that was vertex normal. But looks to be just very close to the edge (can be the shader?). There is no chamfer.
     
  5. AlanMattano

    AlanMattano

    Joined:
    Aug 22, 2013
    Posts:
    1,030
    The houses have a hard poly edge mesh without bevels chamfer.
    Looks like a vertex rotation but just near the edge and not along the surface.
    The surface looks flat and not the usual default smoothing with gradient.
    Usually, to get this effect you need a chamfer as mention on the link.

    CSGO edge vertex normals rotation 01.png
    CSGO edge vertex normals rotation 02.png CSGO edge vertex normals rotation 03.png

    CSGO edge vertex normals rotation 04.png
     
    Last edited: May 14, 2019
  6. Mauri

    Mauri

    Joined:
    Dec 9, 2010
    Posts:
    1,422
    Looks like just clever texturing to me instead of any shader or other shenanigans.
     
    xVergilx likes this.
  7. BIGTIMEMASTER

    BIGTIMEMASTER

    Joined:
    Jun 1, 2017
    Posts:
    2,115
    yeah i agree with Mauri, I think the noisiness of the textures just hides the edge pretty well. It's an old online fast paced shooter -- i doubt there is any wizardry in the shaders and I don't think custom vertex normals were a thing back then.
     
    xVergilx likes this.
  8. LSUTiger85

    LSUTiger85

    Joined:
    Dec 29, 2015
    Posts:
    106
    The correct way to do this is to bevel the edge as noted above, however, it doesn't look like cs:go is doing this. It looks like they are "smoothing" the edge (I don't know why - it's not like beveling a wall edge adds tons of polygons).

    To achieve this in blender, turn auto smoothing all the way up and then apply an edge split modifier with only the "Sharp Edges" option selected. Then select the edges you want to look sharp and make them sharp.

    If I've confused you, just google "edge split modifier" and "sharpen edge".

    ETA: doing this will give you the smooth faded shadow across the edge. You will also have to have a continuous texture across the edge for it to look right. You may want to play with the smoothing with textures applied in Blender, because it's not easy to get a clean look doing this.
     
    Last edited: May 15, 2019
    AlanMattano likes this.
  9. BIGTIMEMASTER

    BIGTIMEMASTER

    Joined:
    Jun 1, 2017
    Posts:
    2,115
    I may be misunderstanding you because I'm not familiar with blender, but if you apply smooth shading to a 90 degree edge it will produce shading errors like so.
    20ba0bc6f2436c393535a14cec01bbe5.png

    Adding bevels is not the "correct" way, it is just one method. Adding bevels drastically increases number of triangles, which in an older online shooter was probably a no-go. Modern specs is a different story.
     
  10. LSUTiger85

    LSUTiger85

    Joined:
    Dec 29, 2015
    Posts:
    106
    Sharpen the top and bottom squares of that cube, leaving the 4 vertical edges not sharp. Then add an Edge Split modifier and unselect "Edge Angle". It will give you a rounded appearance just on those 4 vertical edges - I promise. It's not optimal, it doesn't look totally accurate - as I said, this is where you should use beveling.

    ETA: Beveling is the correct way, just depends on how many segments your willing to accept.
     
    Last edited: May 15, 2019
  11. LSUTiger85

    LSUTiger85

    Joined:
    Dec 29, 2015
    Posts:
    106
    Here, I did it for you. See how the edge appears to be rounded?

    Smoothed edge: (and yes, this is an old game designer's trick)


    Sharp edge:
     
    AlanMattano and BIGTIMEMASTER like this.
  12. LSUTiger85

    LSUTiger85

    Joined:
    Dec 29, 2015
    Posts:
    106
    Please beware though OP, you can get some really funky results if you do this all over the place. My advice is do not string multiple 90 degree smoothed edges together - as in an edge loop. This will cause weird shadowing that's just not worth it. That's IF you go this route - which I advise not to, just bevel the edge.
     
  13. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    6,752
    The Source engine has a concept of smoothing groups for BSP geometry that affects the lightmaps. These don't work exactly like smoothing groups do on mesh geometry where the entire surface's normal gets "bent", like the examples @BIGTIMEMASTER and @LSUTiger85 posted. Instead it smooths only an area near the edge within the lightmap. The size of this pseudo bevel depends on the lightmap texel size, so very high resolution light maps will produce a sharper edge, a very low resolution light maps will produce a rounder edge. It's very likely just doing this as a blurring of the lightmap along with seam fixups, and not anything fancier like actual subdiv or beveling.

    Note, any real time lighting would not be impacted by this and you'd still see a hard edge.

    https://developer.valvesoftware.com/wiki/Smoothing_groups


    Unity's built in tools don't have anything similar. It would require per-face lightmap settings, which Unity doesn't have.

    However Bakery has some similar functionality through it's seam fixup work, and I seem to remember @guycalledfrank posting an image on twitter where it was being applied across hard edges? But maybe I'm miss remembering something else.
    https://forum.unity.com/threads/bakery-gpu-lightmapper-v1-55-released.536008/

    Other game do this by actually bevelling the geometry, or by placing corner "covers" with rounded normals to hide it (like Overwatch).
     
    AlanMattano and BIGTIMEMASTER like this.