Skip to content

Commit

Permalink
com.unity.renderstreaming@3.0.1-preview
Browse files Browse the repository at this point in the history
## [3.0.1] - 2021-03-04

### Fixed

- Fixed a script error when importing the package sample

### Changed

- `Camerastreamer` uses a `TargetTexture` on the `Camera` component if the `RenderTexture` is attached on the `Camera`.

## [3.0.0] - 2021-03-02

Version 3.0.0 has a big change in the package design. This mainly addresses moving scripts from the sample folder to Package Manager.

### Added

- Supported iOS platform.
- Added new samples.
- Added a documentation for samples.
- Added components (`InputSystemChannelSender`, `InputSystemChannelReceiver`, `WebBrowserInputChannelReceiver`, `SingleConnection` and `Broadcast`).

### Changed

- Moved scripts from the sample folder to Package Manager.
- Upgrading WebRTC package to `2.3.3-preview`.
  • Loading branch information
Unity Technologies committed Mar 4, 2021
1 parent be149cd commit 814fab7
Show file tree
Hide file tree
Showing 11 changed files with 130 additions and 16 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@ All notable changes to com.unity.renderstreaming package will be documented in t
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [3.0.1] - 2021-03-04

### Fixed

- Fixed a script error when importing the package sample

### Changed

- `Camerastreamer` uses a `TargetTexture` on the `Camera` component if the `RenderTexture` is attached on the `Camera`.

## [3.0.0] - 2021-03-02

Version 3.0.0 has a big change in the package design. This mainly addresses moving scripts from the sample folder to Package Manager.
Expand Down
6 changes: 6 additions & 0 deletions Documentation~/components.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,19 @@

This component streams the `Camera` component's camera rendering results. Uses `Target Texture` to store the rendering results.

> [!NOTE]
> You can attach the `Target Texture` to the `Camera` component.
> If `Target Texture` is attached on Camera, use that `Render Texture` setting first.
![Camera Streamer inspector](images/camerastreamer_inspector.png)

### Properties

| Parameter | Description | Default |
| ---------------------------- | ------------------------------------------------------------------- | ------------------------------- |
| **Streaming Size** | Size of the frame buffer used for streaming | 1280, 720 |
| **Anti-aliasing** | The antialiasing level for the RenderTexture | None |
| **Depth Buffer** | The precision of the render texture's depth buffer in bits | No depth buffer |

## `WebCamStreamer`

Expand Down
Binary file modified Documentation~/images/camerastreamer_inspector.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion Documentation~/tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Check Package Manager window, Click `+` button and select `Add package from git
Input the string below to the input field.

```
com.unity.renderstreaming@3.0.0-preview.1
com.unity.renderstreaming@3.0.1-preview
```

The list of version string is [here](https://github.com/Unity-Technologies/com.unity.renderstreaming/tags). In most cases, the latest version is recommended to use.
Expand Down
49 changes: 49 additions & 0 deletions Editor/CameraStreamerEditor.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
using System.Linq;
using UnityEditor;
using UnityEngine;

namespace Unity.RenderStreaming.Editor
{
[CustomEditor(typeof(CameraStreamer))]
public class CameraStreamerEditor : UnityEditor.Editor
{
readonly GUIContent[] renderTextureAntiAliasing = new GUIContent[4]
{
EditorGUIUtility.TrTextContent("None"),
EditorGUIUtility.TrTextContent("2 samples"),
EditorGUIUtility.TrTextContent("4 samples"),
EditorGUIUtility.TrTextContent("8 samples")
};

readonly int[] renderTextureAntiAliasingValues = new int[4] {1, 2, 4, 8};

readonly GUIContent antiAliasing =
EditorGUIUtility.TrTextContent("Anti-aliasing", "Number of anti-aliasing samples.");

readonly GUIContent[] renderTextureDepthBuffer = new GUIContent[3]
{
EditorGUIUtility.TrTextContent("No depth buffer"),
EditorGUIUtility.TrTextContent("At least 16 bits depth (no stencil)"),
EditorGUIUtility.TrTextContent("At least 24 bits depth (with stencil)")
};

readonly int[] renderTextureDepthBufferValues = new int[3] {0, 16, 24};

readonly GUIContent depthBuffer = EditorGUIUtility.TrTextContent("Depth Buffer", "Format of the depth buffer.");

public override void OnInspectorGUI()
{
serializedObject.Update();

EditorGUILayout.PropertyField(serializedObject.FindProperty("streamingSize"));
var antiAliasingProperty = serializedObject.FindProperty("antiAliasing");
EditorGUILayout.IntPopup(antiAliasingProperty, renderTextureAntiAliasing, renderTextureAntiAliasingValues, antiAliasing);
var depthBufferProperty = serializedObject.FindProperty("depth");
EditorGUILayout.IntPopup(depthBufferProperty, renderTextureDepthBuffer, renderTextureDepthBufferValues, depthBuffer);

serializedObject.ApplyModifiedProperties();

EditorGUILayout.HelpBox("If TargetTexture is attached on Camera, use that RenderTexture setting first.", MessageType.Info);
}
}
}
3 changes: 3 additions & 0 deletions Editor/CameraStreamerEditor.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Editor/WebAppDownloader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace Unity.RenderStreaming.Editor
public static class WebAppDownloader
{
const string URLRoot = "https://github.com/Unity-Technologies/UnityRenderStreaming";
const string LatestKnownVersion = "3.0.0-preview.1";
const string LatestKnownVersion = "3.0.1-preview";

// TODO::fix release process of webserver runtime.
const string FileNameWebAppForMac = "webserver_mac";
Expand Down
45 changes: 34 additions & 11 deletions Runtime/Scripts/CameraStreamer.cs
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
using Unity.WebRTC;
using UnityEngine;
using UnityEngine.Experimental.Rendering;

namespace Unity.RenderStreaming
{
[RequireComponent(typeof(Camera))]
public class CameraStreamer : VideoStreamBase
{
[SerializeField] private RenderTextureDepth depth;
[SerializeField, Tooltip("This property is needed to choose from 1,2,4 or 8")]
private int antiAliasing = 1; //ToDO(kannan):using enum
[SerializeField] private int depth = 0;
[SerializeField] private int antiAliasing = 1;


protected Camera m_camera;
private Camera m_camera;
public override Texture SendTexture => m_camera.targetTexture;

protected virtual void Awake()
Expand All @@ -21,14 +21,37 @@ protected virtual void Awake()

protected override MediaStreamTrack CreateTrack()
{
int depthValue = (int)depth;
var format = WebRTC.WebRTC.GetSupportedRenderTextureFormat(SystemInfo.graphicsDeviceType);
var rt = new RenderTexture(streamingSize.x, streamingSize.y, depthValue, format)
RenderTexture rt;
if (m_camera.targetTexture != null)
{
antiAliasing = antiAliasing
};
rt.Create();
m_camera.targetTexture = rt;
rt = m_camera.targetTexture;
RenderTextureFormat supportFormat = WebRTC.WebRTC.GetSupportedRenderTextureFormat(SystemInfo.graphicsDeviceType);
GraphicsFormat graphicsFormat = GraphicsFormatUtility.GetGraphicsFormat(supportFormat, RenderTextureReadWrite.Default);
GraphicsFormat compatibleFormat = SystemInfo.GetCompatibleFormat(graphicsFormat, FormatUsage.Render);
GraphicsFormat format = graphicsFormat == compatibleFormat ? graphicsFormat : compatibleFormat;

if (rt.graphicsFormat != format)
{
Debug.LogWarning(
$"This color format:{rt.graphicsFormat} not support in unity.webrtc. Change to supported color format:{format}.");
rt.Release();
rt.graphicsFormat = format;
rt.Create();
}

m_camera.targetTexture = rt;
}
else
{
RenderTextureFormat format = WebRTC.WebRTC.GetSupportedRenderTextureFormat(SystemInfo.graphicsDeviceType);
rt = new RenderTexture(streamingSize.x, streamingSize.y, depth, format)
{
antiAliasing = antiAliasing
};
rt.Create();
m_camera.targetTexture = rt;
}

return new VideoStreamTrack(m_camera.name, rt);
}
}
Expand Down
16 changes: 16 additions & 0 deletions Samples~/Example/Gyro/Unity.RenderStreaming.GyroSample.asmdef
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"name": "Unity.RenderStreaming.GyroSample",
"references": [
"Unity.InputSystem",
"Unity.RenderStreaming.Runtime"
],
"includePlatforms": [],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [],
"versionDefines": [],
"noEngineReferences": false
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "com.unity.renderstreaming",
"displayName": "Unity Render Streaming",
"version": "3.0.0-preview.1",
"version": "3.0.1-preview",
"unity": "2019.4",
"description": "This is a package for using Unity Render Streaming technology. It contains two samples to use the technology.",
"dependencies": {
Expand All @@ -16,11 +16,11 @@
}
],
"upmCi": {
"footprint": "c1560b9c1ca0d95fc643968a60c260b3ceae7b4a"
"footprint": "cbe62f773b614ee573138d157bab396293a30dd7"
},
"repository": {
"url": "https://github.com/Unity-Technologies/UnityRenderStreaming.git",
"type": "git",
"revision": "6e3492661dfc150a316e0c43e65019353d11793a"
"revision": "ec92d7059723d64dc86c6bf77d22be7d2b8c1411"
}
}

0 comments on commit 814fab7

Please sign in to comment.