Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


Control when Dynamic Scaling happens

Use the DynamicallyScalableExplicit API to scale render targets manually.
Read time 1 minuteLast updated 23 days ago

The
ScalableBufferManager.ResizeBuffers
function immediately scales render textures when called. However, you can modify this behavior by using the
DynamicallyScalableExplicit
flag. Render textures marked with
DynamicallyScalableExplicit
will scale when you call
RenderTexture.ApplyDynamicScale
, instead of being automatically scaled when
ScalableBufferManager.ResizeBuffers
is called. Scaling causes render texture contents to be invalidated, so you must use
DynamicallyScalableExplicit
and
RenderTexture.ApplyDynamicScale
to ensure render texture data persists through scale factor changes.
For instance, temporal anti-aliasing improves the visual quality of the current frame by reusing data from previous frames. If the dynamic resolution scale factor changes between frames, you need to preserve the previous frame's data. You can achieve this by marking the render textures containing this data with
DynamicallyScalableExplicit
, allowing them to remain valid even after calling
ScalableBufferManager.ResizeBuffers
. You only need to resize the current frame's render texture using
RenderTexture.ApplyDynamicScale
, ensuring the previous frame's render texture remains valid for sampling.