背景介绍
WebRTC是Google于2011年开发的一款开源软件,能够让用户在浏览器和移动平台上实现实时P2P通信。
现在Unity也有框架来实现渲染流传输了
下面介绍怎样运行这个框架(教程来源:https://github.com/Unity-Technologies/UnityRenderStreaming/blob/release/1.0.0/Packages/com.unity.template.renderstreaming/Documentation~/index.md)
准备工作
1.Unity2019.1 or higher(作者使用的2019.2.6f1)
2.支持的显卡https://developer.nvidia.com/video-encode-decode-gpu-support-matrix(作者的1070)
3.安装最新的显卡驱动
4.win10 x64(mac暂不支持)
5.最新的Chrome
6.com.unity.webrtc.tgz & com.unity.template.renderstreaming.tgz
7.node.js
步骤
1.将两个.tgz的包放到目录中
<Unity Editor Root>/Data/Resources/PackageManager/ProjectTemplates
2.创建工程
3.打开Window->PackageManager,找到HighDefinitionRP(HDRP),点击Install
4.登陆服务器,服务器exe 在Assets/~bin/中,双击打开即可
5.打开工程中的samplescene并运行,然后运行chorme,并输入127.0.0.1或localhost,即可体验Unity的渲染流传输