I’m trying to get dynamic resolution working on Windows standalone, but no matter what I do, the resolution remains unchanged.
I have a very simple setup with a camera with “Allow Dynamic Resolution” checked, and then a script attached which invokes ScalableBufferManager.ResizeBuffers.
public class TestDynamicResolution : MonoBehaviour
{
[Range(.5f, 1f)]
public float renderScale = .5f;
void Update()
{
ScalableBufferManager.ResizeBuffers(renderScale, renderScale);
}
}
I’ve also enabled Frame Timing Stats (not that it should matter though since I’m invoking ResizeBuffers “manually” anyway).
This doesn’t seem to work though, neither in editor nor in build.
I actually got it working. The problem was that you need to force enable DX12. It even says in the docs that you need DX12 but it’s easy to miss. You can do this by going to player settings and unchecking “Auto Graphics API for Windows” and then adding DX12 and putting it on top.
The problem is that DX12 implementation in Unity isn’t as optimized as other versions, so just by enabling it you will lose frames. So essentially what you’re doing is reducing resolution while gaining 0 frames, i.e. there’s no reason to do it. I’ve also noticed that some things don’t work or will cause Unity to crash while DX12 is enabled, so I really can’t recommend changing the API.
So afaik there’s really no officially supported way to have dynamic resolution in Unity that actually works as desired. (And no, rendering to render texture and blitting to screen doesn’t work since that isn’t compatible with a ton of screenspace effects).
Was just gonna say that dynamic resolution doesn’t seem to work in URP unless DX12 is activated. But this solution seems to work just fine in editor and build, so thanks for sharing that @adamgolden . Odd that this isn’t included in the documetation. Rather, the DX12 only method is advocated.
In HDRP it works just fine according to the documentation, but not in Unity 2020. No changing of any HDRP settings seems to work in Unity 2020 though. I couldn’t even change from deferred to forward in a completely new, clean HDRP project, so, yeah, yikes… Another reason not to touch anything not LTS I suppose.
I want to add that 2020.3 does indeed work, it’s just that the default HDRP project is set up differently.
In the 2019 HDRP project, there are no individual renderpipline assets tied to different quality settings (there is only 1 quality setting, and it doesn’t have a renderpipline asset). In 2020.3 however, there are multiple quality levels, each one with its own individual renderpipline asset. That’s why changing the renderpipline asset referenced in the “Graphics” settings doesn’t do anything, because the ones used in “Quality” options were overriding it.
Thanks to Unity staff for pointing this out in email exchange!
i am still using 2019 LTS in 2022, as well as standard built in render piple, and it seems to make no sense to use ScalableBufferManager.ResizeBuffers() here. sadly
with dx11 my super heavy loaded multi million poly scene with lotsof overdraw (jungle) runs so much better with dx11 than with dx12 … so why should i switch to then dynamically reduce my resolution of render targets ??
Indeed, for built in there’s no advantage to doing so. I haven’t tested how resolution scaling works in URP and HDRP, but that might be something to check out. That together with FSR or DLSS may be the approach to go if you wanna try to squeeze out more frames.
Great, thanks for this. Also you are not kidding about the horrible DX12 performance when using the built-in renderer. DX12 is completely unuseable, and makes Dynamic resolution pointless on built-in. I wonder if this will be updated in 2022? I’m not holding my breath.