Changing URP Asset Render Scale affects decal's rendering

Changing the render scale of a Universal Render Pipeline Asset changes the position of the new decals renderer feature introduced in Unity 2021.2.


It’s pretty easy to reproduce, just add the new decals to a scene and change the slider “Render Scale” to a value different than 1, the decals completely disappear at some point. Already sent a bug report.

3 Likes

@ali_mohebali +1

I really needed this to work or else I’ll have to find another Decal solution for URP, still have no reply on the bug report, I don’t know how long they usually take to acknowledge a bug.

I would probably wait for 2021.2 to go out of beta before looking for a different solution.

Alternatively you might be able to change the Decal Shader Graph to include this yourself (if that’s possible).

I’m releasing a new game soon so I need it solved or have a different solution, which I have but they are not as performant.

I know I shouldn’t use a beta Unity version for a production build but I really liked some changes they introduced in 2021.2 and the only problem that I found was this one.

I also tried changing the Decal’s Shader Graph but couldn’t fix the problem, I think it’s something to do internally with the way they made Decals work in URP. But if someone has a hack for it I would really appreciate it!

i was having the same problem. Then I saw that it was actually fixed on github, but it was kept waiting.

com.unity.render-pipelines.universal\Runtime\ScriptableRenderer.cs

line 221.
cmd.SetGlobalVector(ShaderPropertyId.screenSize, new Vector4(cameraWidth, cameraHeight, 1.0f / cameraWidth, 1.0f / cameraHeight));

fix
cmd.SetGlobalVector(ShaderPropertyId.screenSize, new Vector4(scaledCameraWidth, scaledCameraHeight, 1.0f / scaledCameraWidth, 1.0f / scaledCameraHeight));

The problem is that the wrong screen pixel value is sent to the camera. This is a bug that is found in too many places. Lens flare is broken, for example, due to the same error.

8 Likes

Thank you so much, it worked!

I had to do some small changes to make it work, first was copying the com.unity.render-pipelines.universal package from Library\PackageCache\ to Packages\ and making sure it didn’t have the @version number at the end. After that and making the changes to the “ScriptableRenderer.cs” there was an error appearing when changing the Render Scale on “DecalRendererFeature.cs” saying that the m_DecalEntityManager was null, so I had to add a new line on the method “OnCameraPreCull”

if (m_DecalEntityManager == null)
            {
                m_DecalEntityManager = sharedDecalEntityManager.Get();
            }

For some reason the m_DecalEntityManager gets null when you change the renderer scale so had to do this little hack for now.

2 Likes

This is still broken in 12.5.1, despite it being allegedly fixed in 12.4.1:

  • VFX: Incorrect Decal rendering when rendescale is different than one case 1343674
1 Like

still broken … but to be honest, I welcome the 0.2 fps gain … rather have a “high fidelity” mode and a “low, just performance” and build the levels with that limitation/quirk in mind.

It’s not just decals, special effects are affected as well.

So much for the “cross platform compatability”, but I understand it’s insanely hard what you are doing, so thank you for your effort.

2021.3 LTS still broken.
@ali_mohebali

2 Likes

I have the same problem.
2021.1, 2021.2, and 2021.3 LTS.

Can confirm this is still in 2021.3 LTS. My fix as posted here

Still works.

1 Like

Hey, seems like it was a bit oversight as the bug fix refers to VFX decals, but as you see the problems is with ShaderPropertyId.screenSize in general.
So it is safe to use proposed wokraround and we will try to fix the bug as soon as we can.
This bug can be used for tracking https://issuetracker.unity3d.com/issues/urp-decal-material-moves-out-of-bounds-when-changing-the-render-scale-value-of-the-universal-render-pipeline-asset.

I actually can not reproduce on latest unity version. As I understand changing render scale causes m_DecalEntityManager to be null?

1 Like

It’s quite easy to reproduce; have more than 1 profile, and drag the resolution scale slider up and down on one of them that’s not active.

It’s still broken in 2021.3.2 and 2022.1.0

1 Like

And 2022.1.1 in URP 13. I know this as I just downloaded it fresh and am having to apply my bandaid again. Do I take it that literally no-one has released a URP game with decals since Oct 20, 202 1?

Same. Still waiting for the fix. Hope it will be fixed as well in 2022.1.

That is a smaller issue which still exists, yes, but the bigger issue is the original one that started this thread - decals are positioned incorrectly whenever render scale is not 1.0.

https://issuetracker.unity3d.com/issues/urp-decal-rendering-is-affected-when-changing-render-scale-value has been in a status of “Fix in Review” for a very long time.

I would cheerfully upload my project which reproduces all sorts of URP Decal horror, but it’s 85 gigs in size :wink:

https://i.gyazo.com/7589eace541007ffa4575d17373a012d.mp4

Users have reported the exact line number of the problem and how to fix it (such as in this post , as one example). But it has been broken for a year and we’re still forced to embed custom versions of the URP package in our projects to workaround it to this day.

I submitted a minimalist repro project that demonstrates the bug without any extraneous noise with bug report IN-9027, but still nothing has happened.

Changing URP Asset Render Scale affects decal's rendering - Unity Engine - Unity Discussions still shows “Fix in Review” after a long, long time.

We would all like for this bug to be fixed, but there’s a bigger question here about what the process is inside of Unity for dealing with these things? The community is baffled that this bug is still here after so long. Can anyone from Unity elaborate on the process and how this kind of thing stays broken for so long? I think it might help us all come together better and be more productive if we better understood what is preventing Unity from just changing the one line of code and merging it into the appropriate branches for RC sweeps and release. That would be so appreciated!

4 Likes