Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Question Creating a Vignette Effect in Unity URP without Post Processing

Discussion in 'Universal Render Pipeline' started by TechZ_007, May 11, 2023.

  1. TechZ_007

    TechZ_007

    Joined:
    Jun 3, 2019
    Posts:
    4
    Hello Community members,

    I had previously created a custom shader to be applied to the camera to give a vignette effect without post-processing, which was working great. However, when I recently converted my project to URP, the custom shader no longer seems to work. I'm not very experienced with shaders, so I'm looking for advice on how to create a vignette effect in URP using a similar technique or maybe a quad in front of the camera.

    I'm hoping someone can provide me with some guidance on how to accomplish this. Perhaps someone has already created a URP-compatible vignette shader that they can share with me? Alternatively, I'm open to any suggestions for how to create the effect.

    Thank you in advance for your help and advice!
     
  2. DevDunk

    DevDunk

    Joined:
    Feb 13, 2020
    Posts:
    4,244
    2022.2+ have a full screen shader in shader graph, which would work the best probably.
     
  3. TechZ_007

    TechZ_007

    Joined:
    Jun 3, 2019
    Posts:
    4
    Sorry, but my access is limited to LTS versions and as of now I have 2021.3.1f1 only.
     
  4. TechZ_007

    TechZ_007

    Joined:
    Jun 3, 2019
    Posts:
    4
    This was my implementation earlier before switching to URP:
    1I had created a script VignetteEffect attached to the camera:
    upload_2023-5-12_2-35-17.png

    2) this was the shader being used by the above script:
    upload_2023-5-12_2-39-52.png
     
  5. AshwinTheGammer

    AshwinTheGammer

    Joined:
    Sep 23, 2016
    Posts:
    68
    easy
    Download transparent vignette texture from internet(in high resolution)
    create a RawImage UI
    apply the texture to it
    then you can enable or disable it
    change its alpha value over time to create fade in/out effect
     
  6. DevDunk

    DevDunk

    Joined:
    Feb 13, 2020
    Posts:
    4,244
    That won't be good ad scaling with different resolutions tho. And a shader might use less GPU bandwidth, but that depends on the setup and device
     
  7. AshwinTheGammer

    AshwinTheGammer

    Joined:
    Sep 23, 2016
    Posts:
    68
    Thats why we have 'Canvas Scaler'
     
  8. DevDunk

    DevDunk

    Joined:
    Feb 13, 2020
    Posts:
    4,244
    But that will stretch the image, which can be undesirable
     
  9. wwWwwwW1

    wwWwwwW1

    Joined:
    Oct 31, 2021
    Posts:
    610
    You can create a custom renderer feature to apply your shader to URP renderer at a specific point during rendering.

    The vignette shader should work without modifications because it's an unlit shader.
     
    DevDunk likes this.