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. Unity 2022.2 is now available as the latest Tech release.
    Dismiss Notice
  3. We are making some changes to the DOTS forums.
    Dismiss Notice
  4. Have a look at our Games Focus blog post series which will show what Unity is doing for all game developers – now, next year, and in the future.
    Dismiss Notice

Question Custom renderer features broken on 10.0.0-preview.26

Discussion in 'Universal Render Pipeline' started by ryanslikesocool, Oct 1, 2020.

  1. ryanslikesocool

    ryanslikesocool

    Joined:
    Jul 31, 2016
    Posts:
    47
    After updating from URP 8.2.0 to 10.0.0-preview.26, I noticed that my custom renderer features broke for no apparent reason. I didn't see any breaking changes in the change log so I'm kinda wondering what's up. The simplest one that broke was blitting from the camera texture to a temp texture with an invert material (to invert the colors) then blitting back to the camera texture. Any ideas what could be wrong?
     

    Attached Files:

  2. Karearea

    Karearea

    Joined:
    Sep 3, 2012
    Posts:
    372
    Bumping this one as I’ve had the same issue.

    Also affects the Azure Sky renderer feature, the author of that asset has had a look and concurs it’s a breaking change on the URP side with no documentation.
     
    elJoel likes this.
  3. Oxeren

    Oxeren

    Joined:
    Aug 14, 2013
    Posts:
    120
    Same thing, all my custom renderer features just stopped working after going from 8.2 to 10 (meaning they are enabled, there are no errors, but they have no effect). Since built-in features like SSAO and Render Objects do work, I guess there are some changes as to how renderer features have to be implemented.
    Edit: quick glance at the SSAO source has not enlightened me.
     
    Last edited: Oct 10, 2020
  4. Oxeren

    Oxeren

    Joined:
    Aug 14, 2013
    Posts:
    120
    The interesting thing is, even though custom renderer features do not work in the scene and game views, for some reason they still kinda work in the preview window, though not exactly how they should.
     
  5. Kichang-Kim

    Kichang-Kim

    Joined:
    Oct 19, 2010
    Posts:
    890
  6. elJoel

    elJoel

    Joined:
    Sep 7, 2016
    Posts:
    124
  7. Oxeren

    Oxeren

    Joined:
    Aug 14, 2013
    Posts:
    120
    Apparently it's not a bug. I've updated to 10.1, and now they have added a warning: "You can only call cameraColorTarget inside the scope of a ScriptableRenderPass. Otherwise the pipeline camera target texture might have not been created or might have already been disposed."
    So doing things like pass.Setup(renderer.cameraColorTarget) in AddRenderPasses of your scriptable renderer feature does not work anymore and camera color needs to be accessed from the pass itself. Good thing is, they have actually fixed Blit feature from Universal Rendering Examples (it's now called DrawFullscreenFeature). I've grabbed it and replaced the old Blit feature in my project and voila, it worked.
     
  8. nasos_333

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    11,650
    So is again like using a new engine and we have to redo everything and waste million time to fix things. This is getting really out of hand, it is impossible to keep up with such radical changes happening on a such fast pace.

    I hope Unity roll back those changes and make everything working again, this is the only real solution.

    Or perhaps fix the issue when out of beta, as it might be because this is a not ready for release version and beta (lately betas of unity are like nowhere near beta actually)
     
  9. elJoel

    elJoel

    Joined:
    Sep 7, 2016
    Posts:
    124
    Thanks that helped! Basically I had to move stuff from AddRenderPasses to OnCameraSetup
     
    Qhuhuit, laurentlavigne and nasos_333 like this.
  10. nasos_333

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    11,650
    Is there something similar needed for HDRP as well ?
     
  11. Oxeren

    Oxeren

    Joined:
    Aug 14, 2013
    Posts:
    120
    I don't work with HDRP so no idea, sorry.
     
    nasos_333 likes this.
  12. nasos_333

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    11,650
    I get this in Unity 2022.1.9

    Which worked fine in 2021.3.0 !!!!

    ERROR

    You can only call cameraColorTarget inside the scope of a ScriptableRenderPass. Otherwise the pipeline camera target texture might have not been created or might have already been disposed.

    CODE

    // Here you can inject one or multiple render passes in the renderer.
    // This method is called when setting up the renderer once per-camera.
    public override void AddRenderPasses(ScriptableRenderer renderer, ref RenderingData renderingData)
    {
    renderer.EnqueuePass(_scriptablePass);
    _scriptablePass.SetCameraColorTarget(renderer.cameraColorTarget);
    }
     
  13. sifterstudios

    sifterstudios

    Joined:
    Mar 7, 2021
    Posts:
    2
    Hi, did you find a solution to this? I'm in the same situation with the exact same error, probably the same asset as well! ;)
     
  14. Kirsche

    Kirsche

    Joined:
    Apr 14, 2015
    Posts:
    116
  15. Alec-Slayden

    Alec-Slayden

    Joined:
    Dec 16, 2008
    Posts:
    99
    I'm still getting this error spammed after moving the camera target reference to setup.
    upload_2022-9-5_7-18-25.png
     
  16. Mashimaro7

    Mashimaro7

    Joined:
    Apr 10, 2020
    Posts:
    646
    I didn't even make this renderer feature, and I'm just trying to fix it, but i don't really understand, would you be able to elaborate please? This is the original method that's giving the error now,
    Code (CSharp):
    1.         public override void AddRenderPasses(ScriptableRenderer renderer, ref RenderingData renderingData){
    2.             m_ScriptablePass.source = renderer.cameraColorTarget;
    3.             m_ScriptablePass.settings = settings;
    4.  
    5.             renderer.EnqueuePass(m_ScriptablePass);
    6.         }
    What do i need to change the m_ScriptablePass.source = renderer.cameraColorTarget; to?
     
  17. Kirsche

    Kirsche

    Joined:
    Apr 14, 2015
    Posts:
    116
    Try this:
    Code (CSharp):
    1. public override void AddRenderPasses(ScriptableRenderer renderer, ref RenderingData renderingData)
    2. {
    3.     renderer.EnqueuePass(m_ScriptablePass);
    4. }
    5.  
    6. public override void SetupRenderPasses(ScriptableRenderer renderer, in RenderingData renderingData)
    7. {
    8.     m_ScriptablePass.SetSource(renderer.cameraColorTargetHandle);
    9. }
     
    Mashimaro7 likes this.
  18. Mashimaro7

    Mashimaro7

    Joined:
    Apr 10, 2020
    Posts:
    646
    Thanks for the reply, I'm getting an error on "SetSource"



    Do you have any idea why? There doesn't seem to be any solutions in the quick actions.
     
  19. Kirsche

    Kirsche

    Joined:
    Apr 14, 2015
    Posts:
    116
    Oh my bad. I just assumed SetSource was an internal Unity thing. Here's what my RenderPass looks like:

    rider64_2VDr6oTgUs.png

    Hope it helps.
     
    Mashimaro7 likes this.
  20. Mashimaro7

    Mashimaro7

    Joined:
    Apr 10, 2020
    Posts:
    646
    Sorry, I don't even have a class called RenderPass in my project. This render pass I downloaded is using a script called CustomRenderPass, i can't seem to access the ScriptableRenderer class?
     
  21. Kirsche

    Kirsche

    Joined:
    Apr 14, 2015
    Posts:
    116
    Can you just do this in SetupRenderPasses?
    m_ScriptablePass.source = renderer.cameraColorTarget;
     
    Mashimaro7 likes this.
  22. Mashimaro7

    Mashimaro7

    Joined:
    Apr 10, 2020
    Posts:
    646
    Okay it works now, thanks for your help, Not sure I understand why that works, but it fixed it haha.

    Edit: I just noticed it still gives an obsolete message, but for some reason it's functional now... Weird. lol
     
    Last edited: Nov 9, 2022