set and use debug quad to preview stream
This commit is contained in:
parent
5d8557045d
commit
3638e141ec
@ -14,6 +14,8 @@ public class RT3script : MonoBehaviour
|
||||
public string streamKey = "";
|
||||
public string mp4name = "my_movie_depth_ffmpeg.mp4";
|
||||
|
||||
public Material debugMaterial;
|
||||
|
||||
public Texture2D outputImage;
|
||||
|
||||
public int targetFrameRate = 60;
|
||||
@ -21,7 +23,7 @@ public class RT3script : MonoBehaviour
|
||||
|
||||
private Process ffmpegProcess;
|
||||
private string outputMP4;
|
||||
|
||||
private int metadataWidth = 256;
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
@ -39,7 +41,7 @@ public class RT3script : MonoBehaviour
|
||||
colorImage2 = new RenderTexture(256,256,16,RenderTextureFormat.ARGB32);
|
||||
depthImage = new RenderTexture(256,256,16,RenderTextureFormat.ARGB32);
|
||||
depthImage2 = new RenderTexture(256,256,16,RenderTextureFormat.ARGB32);
|
||||
outputImage = new Texture2D(512,512, TextureFormat.RGB24, false);
|
||||
outputImage = new Texture2D(metadataWidth + 512, 512, TextureFormat.RGB24, false);
|
||||
// outputImage = new Texture2D(512,512, TextureFormat.RGBAFloat, false);
|
||||
|
||||
Camera c = GetComponent<Camera>();
|
||||
@ -68,7 +70,7 @@ public class RT3script : MonoBehaviour
|
||||
colorCamera2.CopyFrom(c);
|
||||
colorCamera2.targetTexture = colorImage2;
|
||||
|
||||
|
||||
debugMaterial.mainTexture = outputImage;
|
||||
|
||||
// Initialize FFmpeg process
|
||||
StartFFmpeg();
|
||||
@ -85,11 +87,11 @@ public class RT3script : MonoBehaviour
|
||||
// Graphics.CopyTexture(depthImage, 0, 0, 0, 0, 256, 256, outputImage, 0, 0, 256, 0);
|
||||
|
||||
RenderTexture.active = colorImage;
|
||||
outputImage.ReadPixels(new Rect(0, 0, 256, 256), 0, 0);
|
||||
outputImage.ReadPixels(new Rect(0, 0, 256, 256), metadataWidth + 0, 0);
|
||||
outputImage.Apply();
|
||||
|
||||
RenderTexture.active = depthImage;
|
||||
outputImage.ReadPixels(new Rect(0, 0, depthImage.width, depthImage.height), 0, 256);
|
||||
outputImage.ReadPixels(new Rect(0, 0, depthImage.width, depthImage.height), metadataWidth + 0, 256);
|
||||
outputImage.Apply();
|
||||
RenderTexture.active = null;
|
||||
|
||||
|
80
Assets/screen material.mat
Normal file
80
Assets/screen material.mat
Normal file
@ -0,0 +1,80 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!21 &2100000
|
||||
Material:
|
||||
serializedVersion: 8
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: screen material
|
||||
m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_ValidKeywords: []
|
||||
m_InvalidKeywords: []
|
||||
m_LightmapFlags: 4
|
||||
m_EnableInstancingVariants: 0
|
||||
m_DoubleSidedGI: 0
|
||||
m_CustomRenderQueue: -1
|
||||
stringTagMap: {}
|
||||
disabledShaderPasses: []
|
||||
m_SavedProperties:
|
||||
serializedVersion: 3
|
||||
m_TexEnvs:
|
||||
- _BumpMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailAlbedoMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailMask:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailNormalMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _EmissionMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _MainTex:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _MetallicGlossMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _OcclusionMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _ParallaxMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
m_Ints: []
|
||||
m_Floats:
|
||||
- _BumpScale: 1
|
||||
- _Cutoff: 0.5
|
||||
- _DetailNormalMapScale: 1
|
||||
- _DstBlend: 0
|
||||
- _GlossMapScale: 1
|
||||
- _Glossiness: 0.5
|
||||
- _GlossyReflections: 1
|
||||
- _Metallic: 0
|
||||
- _Mode: 0
|
||||
- _OcclusionStrength: 1
|
||||
- _Parallax: 0.02
|
||||
- _SmoothnessTextureChannel: 0
|
||||
- _SpecularHighlights: 1
|
||||
- _SrcBlend: 1
|
||||
- _UVSec: 0
|
||||
- _ZWrite: 1
|
||||
m_Colors:
|
||||
- _Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
|
||||
m_BuildTextureStacks: []
|
8
Assets/screen material.mat.meta
Normal file
8
Assets/screen material.mat.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 616c36703bce9bd449dfb4a4c0bdf876
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 2100000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Loading…
x
Reference in New Issue
Block a user