From a6752140399c65cf50e4389183a03a6afa229b52 Mon Sep 17 00:00:00 2001 From: Rinvo <49584198+neongm@users.noreply.github.com> Date: Tue, 30 Jan 2024 04:36:38 +0500 Subject: [PATCH 1/2] Add Udon Global Texture support Added checkbox for setting current render texture as global texture to allow using it on avatars --- .../USharpVideo/Scripts/Utility/RenderTextureOutput.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Assets/USharpVideo/Scripts/Utility/RenderTextureOutput.cs b/Assets/USharpVideo/Scripts/Utility/RenderTextureOutput.cs index a0e5600..0f5bf3e 100644 --- a/Assets/USharpVideo/Scripts/Utility/RenderTextureOutput.cs +++ b/Assets/USharpVideo/Scripts/Utility/RenderTextureOutput.cs @@ -4,6 +4,7 @@ using VRC.SDKBase; using VRC.Udon; using System.IO; +using static VRC.SDKBase.VRCShader; #if UNITY_EDITOR && !COMPILER_UDONSHARP using UnityEditor; @@ -25,6 +26,7 @@ public class RenderTextureOutput : UdonSharpBehaviour #pragma warning restore CS0649 public CustomRenderTexture outputTexture; + public bool useUdonGlobalTexture; private Material outputMat; @@ -32,6 +34,11 @@ private void Start() { outputMat = outputTexture.material; videoPlayerManager = sourceVideoPlayer.GetComponentInChildren(true); + + if(useUdonGlobalTexture) + { + SetGlobalTexture(PropertyToID("_Udon_VideoTex"), outputTexture); + } } private Texture lastTex; @@ -107,11 +114,13 @@ void CreateCRT() private SerializedProperty sourceVideoPlayerProperty; private SerializedProperty outputTextureProperty; + private SerializedProperty useUdonGlobalTextureProperty; private void OnEnable() { sourceVideoPlayerProperty = serializedObject.FindProperty("sourceVideoPlayer"); outputTextureProperty = serializedObject.FindProperty("outputTexture"); + useUdonGlobalTextureProperty = serializedObject.FindProperty("useUdonGlobalTexture"); } public override void OnInspectorGUI() @@ -124,6 +133,7 @@ public override void OnInspectorGUI() EditorGUILayout.HelpBox("A source video player must be specified", MessageType.Error); EditorGUILayout.PropertyField(outputTextureProperty); + EditorGUILayout.PropertyField(useUdonGlobalTextureProperty); serializedObject.ApplyModifiedProperties(); From 674cd7375606bd2c750a42ab195987442777da73 Mon Sep 17 00:00:00 2001 From: Rinvo <49584198+neongm@users.noreply.github.com> Date: Sat, 22 Jun 2024 22:35:34 +0500 Subject: [PATCH 2/2] Update README.md --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 2506ac2..5e0f8cf 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ -# USharpVideo -A basic video player made for VRChat using Udon and UdonSharp. Supports normal videos and live streams. +# USharpVideo Plus +A slightly extended version of the classic basic video player made for VRChat using Udon and UdonSharp by Merlin. Supports normal videos and live streams. ![image](https://user-images.githubusercontent.com/36685500/121757261-d4acc480-cad1-11eb-9455-c61b676b9e99.png) @@ -17,6 +17,7 @@ A basic video player made for VRChat using Udon and UdonSharp. Supports normal v - Volume slider - Reload button - Supports YouTube link resolution in the editor the same as in VRC +- Global render texture ## Installation 1. Install the latest VRCSDK and latest release of UdonSharp using the [VRChat Creator Companion](https://vrchat.com/home/download)