Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question Blur AR Camera

Discussion in 'AR' started by Octoputh, May 31, 2023.

  1. Octoputh

    Octoputh

    Joined:
    Sep 15, 2016
    Posts:
    4
    I need some help writing a shader to blur the camera feed in an app using AR Foundation and URP. This would be used when a menu is opened in the app, to blur out the device camera feed behind the UI.

    I've read a few threads on here and it looks like the only way to do this is with a custom material on the AR Camera Background script.

    So far my app is set up correctly with AR foundation (plane detection, anchoring, etc), but when I try and add a custom material to the camera background, I get a solid blue screen. When I uncheck use custom material all ar functions work as expected.

    I renamed the main texture property in the kawase blur shader to _MainTex and added the shader effect to the URP render pipeline asset renderer.

    I'm trying to use the Kawase blur shader to achieve this effect, but if there is a better way to go about this I would gladly switch gears.

    Thanks!
     
  2. zulo3d

    zulo3d

    Joined:
    Feb 18, 2023
    Posts:
    888
    Being able to set the camera's focus would be a great cheap way of doing what you want. I'm not sure if it's possible to do this with AR Foundation but this thread seems to suggest it's now possible if using AR Kit.
     
  3. Octoputh

    Octoputh

    Joined:
    Sep 15, 2016
    Posts:
    4
    I found a way to get the effect I wanted by using this Kawase Blur effect on a ui element with a screen space - camera canvas.

    Setting my ar camera as the camera target for the canvas lets me enable/disable the effect easily.

    Thanks for the response though, I'll take a look at messing with the focus through AR foundation
     
    andyb-unity likes this.