Skip to content

Commit

Permalink
Revert back to Two Video Streams (#8)
Browse files Browse the repository at this point in the history
* Apply two streams

* Update VRTK Sample
  • Loading branch information
vmohan7 authored Aug 23, 2021
1 parent 4b1d068 commit eccc389
Show file tree
Hide file tree
Showing 4 changed files with 90 additions and 57 deletions.
62 changes: 41 additions & 21 deletions Runtime/Prefabs/Render Streaming Services.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ GameObject:
- component: {fileID: 1793859182182230346}
- component: {fileID: 1793859182182230347}
- component: {fileID: 1270632014}
- component: {fileID: 1084652618}
m_Layer: 0
m_Name: WebVR Camera
m_TagString: Untagged
Expand Down Expand Up @@ -50,7 +49,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
local: 0
label:
VRCameras: {fileID: 1084652618}
VRCameras: {fileID: 0}
VRPoseEvent:
m_PersistentCalls:
m_Calls:
Expand Down Expand Up @@ -105,24 +104,6 @@ MonoBehaviour:
VRAxisEvent:
m_PersistentCalls:
m_Calls: []
--- !u!114 &1084652618
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1793859182182230341}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 88dc1ef0a0e7d1b4a897f095b852ab38, type: 3}
m_Name:
m_EditorClassIdentifier:
streamingSize: {x: 2700, y: 1500}
leftEye: {fileID: 1793859182864016192}
rightEye: {fileID: 1793859183251251332}
depth: 0
antiAliasing: 1
BIT_RATE: 9000000
--- !u!1 &1793859182664022047
GameObject:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -273,6 +254,7 @@ GameObject:
m_Component:
- component: {fileID: 1793859182864016220}
- component: {fileID: 1793859182864016192}
- component: {fileID: 5657891410645623095}
m_Layer: 0
m_Name: Left Eye Render Streaming Camera
m_TagString: Untagged
Expand Down Expand Up @@ -337,6 +319,24 @@ Camera:
m_OcclusionCulling: 1
m_StereoConvergence: 10
m_StereoSeparation: 0.022
--- !u!114 &5657891410645623095
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1793859182864016223}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 88dc1ef0a0e7d1b4a897f095b852ab38, type: 3}
m_Name:
m_EditorClassIdentifier:
streamingSize: {x: 1350, y: 1500}
cameras:
- {fileID: 1793859182864016192}
depth: 0
antiAliasing: 1
BIT_RATE: 9000000
--- !u!1 &1793859182968099965
GameObject:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -530,6 +530,7 @@ GameObject:
m_Component:
- component: {fileID: 1793859183251251333}
- component: {fileID: 1793859183251251332}
- component: {fileID: 2367005362525901591}
m_Layer: 0
m_Name: Right Eye Render Streaming Camera
m_TagString: Untagged
Expand Down Expand Up @@ -594,6 +595,24 @@ Camera:
m_OcclusionCulling: 1
m_StereoConvergence: 10
m_StereoSeparation: 0.022
--- !u!114 &2367005362525901591
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1793859183251251330}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 88dc1ef0a0e7d1b4a897f095b852ab38, type: 3}
m_Name:
m_EditorClassIdentifier:
streamingSize: {x: 1350, y: 1500}
cameras:
- {fileID: 1793859183251251332}
depth: 0
antiAliasing: 1
BIT_RATE: 9000000
--- !u!1 &1793859183478774782
GameObject:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -717,7 +736,8 @@ MonoBehaviour:
m_EditorClassIdentifier:
gameID:
streams:
- {fileID: 1084652618}
- {fileID: 5657891410645623095}
- {fileID: 2367005362525901591}
- {fileID: 1793859183478774780}
- {fileID: 1793859182182230347}
--- !u!1 &9010668948091610382
Expand Down
21 changes: 7 additions & 14 deletions Runtime/Scripts/VRCamStream.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,8 @@ public class VRCamStream : VideoStreamBase {

#region Variables
[SerializeField]
[Tooltip("The Left Eye of the VR Camera")]
private Camera leftEye;

[SerializeField]
[Tooltip("The Right Eye of the VR Camera")]
private Camera rightEye;
[Tooltip("The Cameras to combine together for the render texture")]
private Camera[] cameras;

[SerializeField]
[Tooltip("Defines the depth buffer used for render streaming (0, 16, 24, 32)")]
Expand All @@ -31,10 +27,7 @@ public class VRCamStream : VideoStreamBase {
/// </summary>
private string mainConnection = "";


public const uint MAX_FRAMERATE = 90; //default max framerate target

public override Texture SendTexture => leftEye.targetTexture; //should be the same as right eye
#endregion

#region Events
Expand All @@ -60,11 +53,11 @@ protected override MediaStreamTrack CreateTrack() {
};
rt.Create();

leftEye.targetTexture = rt;
leftEye.rect = new Rect(Vector2.zero, new Vector2(0.5f, 1f));

rightEye.targetTexture = rt;
rightEye.rect = new Rect(new Vector2(0.5f, 0f), new Vector2(0.5f, 1f));
// divide cameras into n sections over the canvas
for ( int i = 0; i < cameras.Length; i++) {
cameras[i].targetTexture = rt;
cameras[i].rect = new Rect(new Vector2(i / cameras.Length, 0f), new Vector2(1 / cameras.Length, 1f));
}

return new VideoStreamTrack("VR Camera", rt);
}
Expand Down
62 changes: 41 additions & 21 deletions Samples~/VRTK-Sample/Prefabs/CameraRig VR Streaming.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ GameObject:
m_Component:
- component: {fileID: 5409741706814409633}
- component: {fileID: 5409741706814409661}
- component: {fileID: 1311884957850820708}
m_Layer: 0
m_Name: Left Eye Render Streaming Camera
m_TagString: Untagged
Expand Down Expand Up @@ -194,6 +195,24 @@ Camera:
m_OcclusionCulling: 1
m_StereoConvergence: 10
m_StereoSeparation: 0.022
--- !u!114 &1311884957850820708
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5409741706814409634}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 88dc1ef0a0e7d1b4a897f095b852ab38, type: 3}
m_Name:
m_EditorClassIdentifier:
streamingSize: {x: 1350, y: 1500}
cameras:
- {fileID: 5409741706814409661}
depth: 0
antiAliasing: 1
BIT_RATE: 9000000
--- !u!1 &5409741707147579618
GameObject:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -252,7 +271,6 @@ GameObject:
- component: {fileID: 5409741707227693495}
- component: {fileID: 5409741707227693494}
- component: {fileID: 6050113343620589235}
- component: {fileID: 3910269784793143522}
m_Layer: 0
m_Name: WebVR Camera
m_TagString: Untagged
Expand Down Expand Up @@ -291,7 +309,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
local: 0
label:
VRCameras: {fileID: 3910269784793143522}
VRCameras: {fileID: 0}
VRPoseEvent:
m_PersistentCalls:
m_Calls:
Expand Down Expand Up @@ -346,24 +364,6 @@ MonoBehaviour:
VRAxisEvent:
m_PersistentCalls:
m_Calls: []
--- !u!114 &3910269784793143522
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5409741707227693496}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 88dc1ef0a0e7d1b4a897f095b852ab38, type: 3}
m_Name:
m_EditorClassIdentifier:
streamingSize: {x: 2700, y: 1500}
leftEye: {fileID: 5409741706814409661}
rightEye: {fileID: 5409741708271552633}
depth: 0
antiAliasing: 1
BIT_RATE: 9000000
--- !u!1 &5409741707778225114
GameObject:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -435,7 +435,8 @@ MonoBehaviour:
m_EditorClassIdentifier:
gameID:
streams:
- {fileID: 3910269784793143522}
- {fileID: 1311884957850820708}
- {fileID: 8785673958752523758}
- {fileID: 5409741708046136065}
- {fileID: 5409741707227693494}
--- !u!1 &5409741708046136067
Expand Down Expand Up @@ -500,6 +501,7 @@ GameObject:
m_Component:
- component: {fileID: 5409741708271552632}
- component: {fileID: 5409741708271552633}
- component: {fileID: 8785673958752523758}
m_Layer: 0
m_Name: Right Eye Render Streaming Camera
m_TagString: Untagged
Expand Down Expand Up @@ -564,6 +566,24 @@ Camera:
m_OcclusionCulling: 1
m_StereoConvergence: 10
m_StereoSeparation: 0.022
--- !u!114 &8785673958752523758
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5409741708271552639}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 88dc1ef0a0e7d1b4a897f095b852ab38, type: 3}
m_Name:
m_EditorClassIdentifier:
streamingSize: {x: 1350, y: 1500}
cameras:
- {fileID: 5409741708271552633}
depth: 0
antiAliasing: 1
BIT_RATE: 9000000
--- !u!1 &6050113341623843308
GameObject:
m_ObjectHideFlags: 0
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "com.fusedvr.vrstreaming",
"version": "0.4.0",
"version": "0.4.1",
"displayName": "FusedVR Streaming",
"description": "This VR Streaming Package contains a minimal SDK & prefabs to implement VR Streaming (CloudXR) using WebRTC and Unity Remote Rendering",
"dependencies": {
Expand Down

0 comments on commit eccc389

Please sign in to comment.