[HN Gopher] The Quest for Very Wide Outlines
       ___________________________________________________________________
        
       The Quest for Very Wide Outlines
        
       Author : todsacerdoti
       Score  : 125 points
       Date   : 2021-08-17 11:12 UTC (1 days ago)
        
 (HTM) web link (bgolus.medium.com)
 (TXT) w3m dump (bgolus.medium.com)
        
       | everyone wrote:
       | Good, but I felt like this article was missing the code. Talking
       | about shaders without code feels like talking about physics
       | without any equations.
        
         | iainmerrick wrote:
         | There's full code for the winning JFA version at the end. It's
         | true that there's no code for all the other attempts, but it
         | does link to a bunch of shadertoy pages and the like along the
         | way, so you can get some source code that way.
        
       | jayd16 wrote:
       | Signed distance fields is a really useful technique. Its commonly
       | used in font rendering in games as it lets you dynamically change
       | font weights and add effects like outlines or drop shadows.
        
       | nyanpasu64 wrote:
       | What if instead of mapping positions to 2D points and finding the
       | closest point among 9 samples, you mapped positions to 1D
       | coverage values and picked the maximum value among the 9 samples?
       | Would this make antialiasing easier to implement? What about
       | using 4 samples rather than 9?
       | 
       | I'm concerned that the results turn a single point into a square
       | rather than a circle. Would using non-square-grid point
       | distributions alleviate this?
       | 
       | Perhaps this could be useful for GPU line rendering, though it's
       | a texture-space algorithm and won't solve drawing a thin line in
       | the first place (which I don't know if it's easier than a thick
       | line or not).
        
       | hesdeadjim wrote:
       | Outlines are high on the list of "it should be easy but it's
       | not".
       | 
       | I've explained this many times to art and design directors and
       | there is always the starement of "but this game did it"! To which
       | my response is, this game is on PS4 not mobile, or it required a
       | lot of asset pipeline customization, and/or hand authoring. Of
       | course it can be done, but it may come at the significant expense
       | of other systems.
        
         | wolverine876 wrote:
         | Why are outlines so expensive? The article assumes we all know.
        
       | etaioinshrdlu wrote:
       | I get that this is missing the point a bit... but this effect
       | looks more like something you could add in post-processing,
       | photoshop, or after effects, and not something you really need in
       | your 3d engine.
        
         | Kiro wrote:
         | Surely it all depends on what you're using it for. Maybe I want
         | to create a game where all characters look like that in real-
         | time (think Borderlands but turned up a notch).
         | 
         | Your comment makes it sound like there's only one presumed use-
         | case for this.
        
           | jimmySixDOF wrote:
           | I thought he was only applying this to one or two outlines at
           | a time ? I wonder if there are other performance trade offs
           | when you outline a hundred game elements in frame or
           | something ?
           | 
           | Also, FWIW, this was posted today on Reddit - a nice writeup
           | of "5 ways to draw an outline" in Unity that also tips a hat
           | to the OP article:
           | 
           | https://alexanderameye.github.io/notes/rendering-outlines/
        
         | [deleted]
        
         | t8y wrote:
         | Someone writing a photo or video editing program could use this
         | technique to process images fast. Instagram used to do filters
         | on the CPU then changed to a shader version for a huge speedup.
         | I use JFA in a game to generate outlines of 2D characters that
         | are procedurally generated in the app. Also the JFA is a way of
         | generating voronoi diagrams in log2(textureSize) steps and
         | could be used for anything that uses voronoi diagrams.
         | Generating a distance field is just one use.
        
         | adamrezich wrote:
         | 3D outlines around objects are an increasingly necessary effect
         | in the visual language of modern 3D video games because
         | increases in post-processing and shader tech have made it such
         | that it's hard to identify individual interactable objects in
         | 3D space in increasingly photorealistic environments. the
         | article shows some examples of how this can be used, including
         | the The Last Of Us "rough outline of figures that you can sense
         | behind walls" effect.
        
         | Quenty wrote:
         | It's useful to have as a shader which can help define the
         | visual style of your game. Additionally you can highlight the
         | model from any angle, which is a useful hint to users.
         | 
         | Since the model may be viewed from any direction, this would be
         | very hard to do in post, since there's no way you can get the
         | model to look correct from all angles.
        
       | bartvk wrote:
       | Fantastic article that dives into the deep end. Quote: "At 20
       | pixels it's nearly 10 ms, so I didn't test going above that. At
       | one point I accidentally set the radius to 80 and my GPU locked
       | up."
       | 
       | Never having done any work like this on the GPU, I hadn't
       | realized this would be possible.
        
       | [deleted]
        
       ___________________________________________________________________
       (page generated 2021-08-18 23:01 UTC)