BlueRoseNote/07-Other/Unity/Unity通用渲染管线(URP)系列(十二)——HDR.md
2023-06-29 11:55:02 +08:00

14 lines
1.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

## HDR渲染纹理
HDR渲染仅与后处理结合使用才有意义因为我们无法更改最终的帧缓冲区格式。因此当我们在CameraRenderer.Setup中创建自己的中间帧缓冲区时我们将在适当的时候使用默认的HDR格式`buffer.GetTemporarayRT()`中使用`RenderTextureFormat.DefaultHDR`(后处理效果的RT格式),也就是R16G16B16A16_SFloat而不是LDR的常规默认格式。
逐步执行DrawCall时你会注意到场景看起来比最终结果要暗。发生这种情况是因为这些步骤存储在HDR纹理中。由于线性颜色数据按原样显示因此看起来很暗它错误地解释为sRGB。
![](https://pic1.zhimg.com/80/v2-a5c936841f88bc9a44cd4af65cb940c0_720w.jpg)
![](https://pic2.zhimg.com/80/v2-d528a8301bc04fa50aa97d7692b4fc59_720w.jpg)
为什么亮度会变化?
sRGB格式使用非线性传递函数。显示器会为此调整执行所谓的伽马校正。伽玛调节函数通常用c的2.2次方和c原色近似但实际传递函数略有不同。
## 解决因为高亮区域过小而导致的闪烁问题
<video src="https://vdn1.vzuu.com/SD/d8b32ae4-48e8-11eb-9c34-7640c864ad74.mp4?disable_local_cache=1&auth_key=1634485320-0-0-203192af877eba6f1b1ae62e0e6d165b&f=mp4&bu=pico&expiration=1634485320&v=hw"
</video>