기억저장고

[RenderStreaming] 랜더스트리밍 세팅하기 본문

Unity

[RenderStreaming] 랜더스트리밍 세팅하기

기억해조 2022. 5. 27. 23:39

[사용환경]

RenderStreaming 3.1.0 

unity 2020.3.28f

HDRP

 

Render Streaming 유니티공식 문서

https://docs.unity3d.com/Packages/com.unity.renderstreaming@3.1/manual/index.html

 

About Unity Render Streaming | Unity Render Streaming | 3.1.0-exp.3

About Unity Render Streaming This package contains public APIs and project samples that are built on top of our Unity Render Streaming. We can develop a peer-to-peer streaming solution quickly by using this package. Main features This package provides the

docs.unity3d.com

 RenderStreaming은 PC의 화면을 다른 화면에 스트리밍하는것이다

원래는 최적화 문제나 프레임문제 등으로 Web에서 HDRP를 사용하지 못했지만

 RenderStreaming을 사용하면 Web에서도 HDRP 씬을 볼 수있다! 

 

한글로 된 정보가 거의 없어서... 이해하는데 어려웠었다.ㅠ

 

* RenderStreaming 설치방법

 https://docs.unity3d.com/Packages/com.unity.renderstreaming@3.1/manual/installation.html

 

Installing The Package | Unity Render Streaming | 3.1.0-exp.3

Installing The Package Note In Unity 2020.3 and 2019.4, there are differences about how to install Unity Render Streaming package so please pay attention to the Unity version you are using and follow the instructions below. Case of Unity 2019.4 Select Wind

docs.unity3d.com

위에 링크를 참고하면 된다

PackageManage > + 버튼 클릭 > Add package from git URL.... > 아래의 URL입력 >  RenderStreaming 다운로드 됨

com.unity.renderstreaming@3.1.0-exp.3

 

 

샘플프로젝트 다운받기

* 다운로드 후, 샘플 프로젝트를 꼭 다운받기 (샘플이 잘되있음 + 맨땅에 하는거보다 훨~씬 이해가 잘되고 좋음)

 

 

* WebServer 실행방법

https://docs.unity3d.com/Packages/com.unity.renderstreaming@3.1/manual/launch-webapp.html

 

Launching The Web Application | Unity Render Streaming | 3.1.0-exp.3

Launching The Web Application After installing the package, you will need to install and run the signaling server. If you want to learn about signaling, you can see this page. Download web application Click on Edit > Render Streaming > Download web app men

docs.unity3d.com

위에 링크를 참고하면된다

 

Editor - RenderStremaing - Download web app 클릭 시 WebServer.exe 다운됨

Editor -RenderStreaming - Download App 클릭 > WebServer.exe 다운됨

 

!!!중요!!!

WebSever.exe를 바로 실행시키면 안되고.. WebSocket 버전으로 실행시켜야함

(나는 암것도 모르고 바로 더블클릭해서 실행시키고, 바로~~~ 샘플프로젝트 실행시켰는데 안되서 당황했었음..) 

 

-WebSocket 버전으로 실행시키는법

WebServer.exe 웹소켓으로 실행방법

1. cmd 실행

2. WebSever.exe 위치로 이동     예) cd C:\Users\Chaelin\Documents

3.  .\webserver -w 작성

.\webserver -w

 

이렇게하면 프로젝트,웹서버까지 준비완료..

 

--

WebServer.exe가 C이외 드라이브에 설치된경우..

(사용하는 드라이버):

이렇게  작성 후 엔터.. 그리고 주소치면 됨.. (난몰랐슴)

d:

--

Nodejs WebServer 실행 시 바로 꺼지는 경우

Cmd에서 실행시 이미 사용하고있는 포트라고 하는 경우


*해결방법
https://jun7222.tistory.com/568

 

윈도우 80 포트 사용중인 기본 서비스 확인 및 끄기

윈도우 환경에서 80포트를 사용하려고 할 때 이미 사용하고 있는 포트라고 하면서 원하는 서비스가 안켜지는 경우가 있습니다. 따로 사용자가 실행중인 프로그램이 없는데도 이런 문제가 있다

jun7222.tistory.com


요약
1. Wid + R 키 눌르고, services.msc 입력
2. World Wide Web Publishing 서비스 클릭
3. 서비스 상태 밑에 중지 버튼 클릭

 

--

Unity RenderStreaming 연결 주소 변경하는방법
***전제조건: RenderStreaming 샘플 패키지 설치 (샘플프로젝트에 있는 코드를 수정할꺼기 때문)***


1. RenderPipelineSample.cs 에서, SignalingAddress추가 
--> RenderStreamingSettings.SignalingAddress = "ws://192.168.0.40:80"; 

 

[수정한 코드]

using UnityEngine;

namespace Unity.RenderStreaming.Samples
{
    class RenderPipelineSample : MonoBehaviour
    {
        [SerializeField] RenderStreaming renderStreaming;

        // Start is called before the first frame update
        void Start()
        {
            if (!renderStreaming.runOnAwake)
            {
                RenderStreamingSettings.SignalingAddress = "ws://192.168.0.40:80";
                renderStreaming.Run(
                    hardwareEncoder: RenderStreamingSettings.EnableHWCodec,
                    signaling: RenderStreamingSettings.Signaling);
            }
        }
    }
}
Comments