背景介紹
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的渲染流傳輸