25
ProtoStar次世代的移动端渲染 Unreal Open Day 2016 EpicGames China 王祢 UE4移动端的一些新特性以及Vulkan支持

ProtoStar:“次世代”的移动端渲染

  • Upload
    ning-hu

  • View
    536

  • Download
    7

Embed Size (px)

Citation preview

Page 1: ProtoStar:“次世代”的移动端渲染

ProtoStar:“次世代”的移动端渲染

Unreal Open Day 2016

EpicGames China

王祢

UE4移动端的一些新特性以及Vulkan支持

Page 2: ProtoStar:“次世代”的移动端渲染

Content

• UE4已有的移动端特性简介(在ProtoStar前)• ProtoStar Demo–开发过程– ProtoStar用到的新加入的移动端图形技术

• Vulkan–简介–对比OpenGL ES对移动端带来的优势

Unreal Open Day 2016

Page 3: ProtoStar:“次世代”的移动端渲染

当前移动设备性能

Unreal Open Day 2016

Page 4: ProtoStar:“次世代”的移动端渲染

UE4已有的移动端特性

• 基于PBS的材质,和PC同样的编辑器• 简化的EnvBRDF,依然能量守恒• HDR

• 一些高质量的后处理– Bloom

– DoF

– Tonemapping

– Light Shafts

Unreal Open Day 2016

Page 5: ProtoStar:“次世代”的移动端渲染

UE4已有的移动端特性

• 支持丰富的贴图压缩格式• PC上方便的ES2预览• Device Profile和Scalability设置• Shader模板的简化设置及分支(Fully Rough, No Metal)• 设备logger输出和远程命令调试• 批量设备发布和测试• 发热优化

Unreal Open Day 2016

Page 6: ProtoStar:“次世代”的移动端渲染

ProtoStar

• 于今年二月首次在三星的S7 launch活动上展出

• 目的– 在移动设备上展示主机品质的画面– 完成UE4对Vulkan API的支持

• 需求– 在零售版本的S7上完成可实时交互的demo– 1080p full HD– 30 FPS

Unreal Open Day 2016

Page 7: ProtoStar:“次世代”的移动端渲染

ProtoStar

• Here goes the video

Unreal Open Day 2016

Page 8: ProtoStar:“次世代”的移动端渲染

ProtoStar开发过程

• 开发过程– 2015.11月 – 2016.2月• S7于2月21日发布,所以deadline卡的很死

– 3个团队合作• Vulkan RHI团队(USA)• 移动端图形特性团队(韩国/英国)• 内容团队(USA)

Unreal Open Day 2016

Page 9: ProtoStar:“次世代”的移动端渲染

ProtoStar开发过程

• 需要克服的问题:–大量的需要用到的feature在当前UE4移动端中并不存在– Vulkan API还不存在–硬件驱动还不存在–硬件本身也还不存在–时间和人力资源都很紧缺

• 因为时间的关系,内容和功能开发团队必须和Vulkan RHI同时做开发

Unreal Open Day 2016

Page 10: ProtoStar:“次世代”的移动端渲染

ProtoStar开发过程

• 先在编辑器中用PC的渲染器和特性集做测试

Unreal Open Day 2016

Page 11: ProtoStar:“次世代”的移动端渲染

ProtoStar开发过程&新特性

• 移植所需要的渲染特性到high-end的移动平台

Unreal Open Day 2016

Depth of Field GPU Particles

Page 12: ProtoStar:“次世代”的移动端渲染

ProtoStar开发过程&新特性

Unreal Open Day 2016

Realtime Planar & Dynamic Shadows

Page 13: ProtoStar:“次世代”的移动端渲染

ProtoStar开发过程

• 比较用DX11,PC和移动端Vulkan的效果

Unreal Open Day 2016

Page 14: ProtoStar:“次世代”的移动端渲染

Vulkan简介

Unreal Open Day 2016

• Vulkan是用来替代OpenGL和OpenGL ES的下一代图形API

• 由Khronos领头,整个行业共同参与打造• 开放,跨平台,支持PC、主机和移动设备• 提供更底层轻度的,更高效的接口• 考虑了现代图形硬件而设计• 以SPIR-V格式作为shader预编译的中间格式

Page 15: ProtoStar:“次世代”的移动端渲染

OpenGL – Tile-Based GPU

Unreal Open Day 2016

• Mobile GPUs大部分斗使用tile架构• 屏幕分成多个区域(eg 32x32)s

• 对于每个render pass,逐tile计算:–光栅化面片,计算overlap的tile

–对每个面片计算pixel shader

–渲染结果存储在GPU核内的快速缓存中–当一个tile的面片计算都处理完后,写回framebuffer

Page 16: ProtoStar:“次世代”的移动端渲染

OpenGL – Tile-Based GPU

Unreal Open Day 2016

这里有个很大的问题:

• 如果你要在tile上做一个新的render pass,gpu必须把tile内的中间数据写会framebuffer–之后,要继续处理这个tile的时候,需要重新从

framebuffer读回数据到gpu core

• 这个过程相当缓慢,有时候以ms为单位!

Page 17: ProtoStar:“次世代”的移动端渲染

Vulkan – RenderPass

• Vulkan有显式的RenderPass– vkBeginRenderPass(...)

– vkEndRenderPass(...)

• 每个render pass可以指定哪些数据需要load到tile memory里,哪些数据需要存回framebuffer

• 这也是为什么在S7上能运行ProtoStar的关键!

Unreal Open Day 2016

Page 18: ProtoStar:“次世代”的移动端渲染

Vulkan - PSO

OpenGL:

• Set vertex and pixel shaders• Shader uniform parameters• Bound textures• Set blending states• Set depth states• Set rasterizer states• Etc…

Vulkan:• 把这些属性和状态都封装在一个对象中• 切换不同的状态相当高效!

Unreal Open Day 2016

Page 19: ProtoStar:“次世代”的移动端渲染

Vulkan – Shader Compiling

OpenGL:• 如果compile出错,在运行时会crash• 做绘制调用的时候会有hitch,驱动只在第一次绘制时才真的编译

Vulkan:• 可离线编译shader

• 在开发时可编译成SPIR-V二进制数据• 所有shader的验证都在离线时完成• 所有上层的shader优化都在离线时完成

Unreal Open Day 2016

Page 20: ProtoStar:“次世代”的移动端渲染

Vulkan – Pipeline State Cache

OpenGL shaders:

• 驱动可能会cache部分编译完的shader

• 第一次运行很慢

• 有个别Extension可以保存“program binaries”

• UE4中诱骗驱动做实际的compile

Vulkan shaders in UE4:

• Pipeline states和shader能离线存储到cache中

• 无需运行时编译,第一次运行也不会有hitch!

Unreal Open Day 2016

Page 21: ProtoStar:“次世代”的移动端渲染

Vulkan – Validation Layers

OpenGL:

• API中的验证和检查代码开销

• 始终存在,所有的调用中都存在

Vulkan:

• 所有的验证都旨在开发阶段使用,run-time驱动中不使用• 既然run-time没有开销,那么就能验证更多东西• 对开发和debug很有帮助• 完全不影响run-time!

Unreal Open Day 2016

Page 22: ProtoStar:“次世代”的移动端渲染

Vulkan – 总结

Unreal Open Day 2016

• 更轻度的API, 小化图形API在CPU上的overhead

• 更底层和轻度的API带来了更多的Draw Call

• 更明确的Render Passes,更好的利用tile GPU的硬件性能• 行为上的一致性• SPIR-V

Page 23: ProtoStar:“次世代”的移动端渲染

在UE4使用Vulkan

• 在移动设备上开启主机画质的可能性!

• 安装Vulkan SDK

• UE4.12 preview2中已经有体验性的Vulkan支持– Github上的源码版本有更多Vulkan相关的支持和代码

• 在项目设置的Android设置中打开Vulkan测试吧

Unreal Open Day 2016

Page 24: ProtoStar:“次世代”的移动端渲染

Unreal Open Day 2016

THANKS

Q&A?

Page 25: ProtoStar:“次世代”的移动端渲染

Unreal Open Day 2016

THANKS

WelcometojoinEpic!We’rehiring!