Custom renderer features broken on 10.0.0-preview.26

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?

6369444–708948–MyBlitFeature.cs (1.55 KB)
6369444–708951–MyBlitRenderPass.cs (2.85 KB)

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.

1 Like

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.

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.

It seems URP’s bug.

3 Likes

This PR https://github.com/Unity-Technologies/Graphics/pull/1861 was merged. Yet did not fix the problem for me.

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.

4 Likes

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)

1 Like

Thanks that helped! Basically I had to move stuff from AddRenderPasses to OnCameraSetup

3 Likes

Is there something similar needed for HDRP as well ?

I don’t work with HDRP so no idea, sorry.

1 Like

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);
}

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! :wink:

The offical upgrade guide explains how to do it:
https://docs.unity3d.com/Packages/com.unity.render-pipelines.universal@13.1/manual/upgrade-guide-2022-1.html

Basically you move your calls in question to the SetupRenderPasses override.

1 Like

I’m still getting this error spammed after moving the camera target reference to setup.

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,

        public override void AddRenderPasses(ScriptableRenderer renderer, ref RenderingData renderingData){
            m_ScriptablePass.source = renderer.cameraColorTarget;
            m_ScriptablePass.settings = settings;

            renderer.EnqueuePass(m_ScriptablePass);
        }

What do i need to change the m_ScriptablePass.source = renderer.cameraColorTarget; to?

1 Like

Try this:

public override void AddRenderPasses(ScriptableRenderer renderer, ref RenderingData renderingData)
{
    renderer.EnqueuePass(m_ScriptablePass);
}

public override void SetupRenderPasses(ScriptableRenderer renderer, in RenderingData renderingData)
{
    m_ScriptablePass.SetSource(renderer.cameraColorTargetHandle);
}
1 Like

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.

Oh my bad. I just assumed SetSource was an internal Unity thing. Here’s what my RenderPass looks like:

8572601--1147841--rider64_2VDr6oTgUs.png

Hope it helps.

1 Like

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?