内容简介:有两种策略Prior to Unreal Engine 4 (UE4) version 4.19, you only had to change the screen percentage, but it has now been split into two types of scaling during the rendering pipeline: Primary and Secondary Spatial Upscaling.整体缩小比例渲染,在绘制UI之前upscale,,一般混在最后一个后期pa
Unreal升采样策略
有两种策略
Prior to Unreal Engine 4 (UE4) version 4.19, you only had to change the screen percentage, but it has now been split into two types of scaling during the rendering pipeline: Primary and Secondary Spatial Upscaling.
-
Primary Spatial Upscaling is the same screen percentage that has been used previously. It is based on the idea of rendering a frame at a lower resolution and then upscaling it before the user interface (UI) is drawn.
-
Secondary Spatial Upscaling does a second and final spatial upscale pass, independently of the Primary upscaling pass.
Primary Spatial Upscaling
整体缩小比例渲染,在绘制UI之前upscale,,一般混在最后一个后期pass里一起做
The tonemapper integrates a simple bilinear color space spatial upscale that can be used for performance reasons when enabled using a value of 1. However, if a Post Process Material is inserted after the tonemapper, the tonemapper won’t do the upscale. It will fall back to using the primary spatial upscale as if it were disabled.
升采样质量级别
Primary Spatial Upscaling 的一种:TAA Upsample也叫 Temporal Upsampling
In addition to Primary Spatial Upscale, a second upscaling technique is also supported for the primary screen percentage: Temporal Upsample. Instead of performing temporal integration with the Temporal Anti-Aliasing (TAA) and then doing a primary spatial upscale, both happen at the same time in the Temporal Anti-Aliasing Upsample (TAAU) shader. It also allows them to converge to sharper images than what a spatial-only upscale could provide but comes at a higher cost since a larger number of post processes run at a higher resolution. It also allows for primary screen percentage changes to be hidden by dynamic resolution allowing it change more often to match the GPU budget as closely as possible.
As the primary screen percentage decreases, the convergence to a clean full-resolution output changes. Therefore, some existing TAA artifacts would be more noticeable. For example, aliasing can become an issue for very thin geometry increasing the probability to miss this geometric detail as the primary screen percentage is lowering.
Secondary Spatial Upscale
TAA升采样一次,最后一个pass再升采样一次
弄到Unity试了一下果然36Tap高斯的结果最好
Unity中动态分辨率升采样策略
Don’t use SetResolution to dynamically change the resolution for performance. Instead have your camera render to a render texture which you Blit() to the framebuffer (Blit to a null destination). Get a temporary render target each frame and adjust its size depending on the current framerate. Usually this is done for the “game” camera only and the UI camera is left at full res. This has been the standard practice for console games since the original Xbox era.
Game相机的CameraTarget用低分辨率(可以根据帧率动态改变分辨率),在UICamera渲染之前用Upscample升到全分辨率
void OnPreCull () { if (Globals.Configdata.DynamicFPS) { if (Globals.Configdata.resolutionWidth == 0 || Globals.Configdata.resolutionHeight == 0) { Globals.Configdata.resolutionWidth = Screen.currentResolution.width; Globals.Configdata.resolutionHeight = Screen.currentResolution.height; } cameraTarget = RenderTexture.GetTemporary (Globals.Configdata.resolutionWidth, Globals.Configdata.resolutionHeight, 24); Camera.main.targetTexture = cameraTarget; // this ensures that w/e the camera sees is rendered to the above RT } }
camera render to a render texture which you Blit() to the framebuffer (Blit to a null destination).
Graphics.Blit (cameraTarget, null as RenderTexture);
Blit null为画到frameBuffer上,,测试表明,PC上Deferred管线下,第二个相机是从FB中取参数的,必须画到frameBuffer上,,iphone
升采样实现
https://www.cs.toronto.edu/~guerzhoy/320/lec/upsampling.pdf
基本思想就是采样周围的点按照一定比例插值混合
不同类型升采样插值的结果
也可以用于resampling
双线性插值算法
参考:
https://docs.unrealengine.com/en-us/Engine/Rendering/ScreenPercentage
https://clouard.users.greyc.fr/Pantheon/experiments/rescaling/index-en.html
https://gis.stackexchange.com/questions/10931/what-is-lanczos-resampling-useful-for-in-a-spatial-context
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网
猜你喜欢:本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
随机密码生成器
多种字符组合密码
RGB HSV 转换
RGB HSV 互转工具