ShaderPrint
UE5相對UE4使用的ComputeShader(GPU Driven)的地方多很多。因為UE5為了方便查看ComputeShader的某些值,開發了“ShaderPrint”,方便直接在Shader 打印信息到屏幕,而不用采用CPUReadback在print的方式。
比如r.nanite.ShowStats等命令是采用了ShaderPrint
如何接入ShaderPrint
r.Lumen.ScreenProbeGather.RadianceCache.Stats是一個比較好的例子,得同時在CPP端和CS端加額外實現。
LumenRadianceCacheDebug.usf是典型案例
CPP端
CS端
ShaderPrintZoom
探測鼠標所在屏幕的局部區域進行像素放大,可以放大化看某些問題
渲染資源顯存占用(buffer和Texture)
參考
Advanced Rendering and Debugging Tips for Unreal Engine 5 | Unreal Fest Gold Coast 2024