Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Edge detection shader for webcam

Discussion in 'Shaders' started by MaeL0000, Sep 10, 2018.

  1. MaeL0000

    MaeL0000

    Joined:
    Aug 8, 2015
    Posts:
    35
    Hi all, I'm trying to achieve the same effect more or less as the "Tron Mode" on the HTC Vive's passthrough camera:


    I would apply a similar effect on the output of a webcam. I've tried searching for this but can't seem to find anything, I'm not sure what this effect is actually called, the closest I could think of was edge detection.

    Can anyone point me in the right direction?
     
  2. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    9,263
    The term you want to search for is Sobel Filter
     
  3. MaeL0000

    MaeL0000

    Joined:
    Aug 8, 2015
    Posts:
    35
  4. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    9,263
    Technically, the way a post process effect works is by copying the screen contents into a texture, then using a shader with that texture. There are simpler examples of using a sobel filter without all of the post processing stuff on top, but you're likely going to want to write a custom shader for this yourself so you can retain some amount of the original image's color if you really do want something like what Valve does to their VR camera pass through view.
     
unityunity