Skip to content

Instantly share code, notes, and snippets.

View JLChnToZ's full-sized avatar

Jeremy Lam aka. Vistanz JLChnToZ

View GitHub Profile
@JLChnToZ
JLChnToZ / VideoShaderCommon.cginc
Created July 13, 2022 12:10
A simple shader for VRChat for SBS 3D video playback support with aspect ratio handling.
// Configurations
// 2D: stereoShift = float4(0, 0, 0, 0), stereoExtend = float2(1, 1)
// SBS (LR): stereoShift = float4(0, 0, 0.5, 0), stereoExtend = float2(0.5, 1)
// SBS (RL): stereoShift = float4(0.5, 0, 0, 0), stereoExtend = float2(0.5, 1)
// Over-Under (Left above): stereoShift = float4(0, 0.5, 0, 0), stereoExtend = float2(1, 0.5)
// Over-Under (Right above): stereoShift = float4(0, 0, 0, 0.5), stereoExtend = float2(1, 0.5)
// Size Mode: 0 = Stratch, 1 = Contain, 2 = Cover
float4 getVideoTexture(sampler2D videoTex, float2 uv, float4 texelSize, bool avPro, int sizeMode, float aspectRatio, float4 stereoShift, float2 stereoExtend) {
float srcAspectRatio = texelSize.y * texelSize.z * stereoExtend.x / stereoExtend.y;
@JLChnToZ
JLChnToZ / vrchatlog.ps1
Last active May 17, 2024 12:26
Live view VRChat runtime log on console legally (mod-free)
$Host.UI.RawUI.WindowTitle = 'VRChat Log'
$Host.UI.RawUI.BackgroundColor = 'Black'
$Host.PrivateData.VerboseForegroundColor = 'White'
Clear-Host
Get-Content -Tail $Host.UI.RawUI.BufferSize.Height -Wait -Encoding UTF8 (Get-ChildItem -Path "$($Env:LocalAppData)Low\VRChat\VRChat" -Filter 'output_log_*.txt' | Sort-Object LastWriteTime -Descending | Select-Object -First 1 | ForEach-Object {$_.FullName}) | Where-Object {$_.Trim() -ne ''} | ForEach-Object {
if ($_ -match '^\d{4}\.\d{2}\.\d{2}\s\d{2}:\d{2}:\d{2}\sError') {
$Host.UI.RawUI.ForegroundColor = $Host.PrivateData.ErrorForegroundColor
$Host.UI.RawUI.BackgroundColor = $Host.PrivateData.ErrorBackgroundColor
} elseif ($_ -match '^\d{4}\.\d{2}\.\d{2}\s\d{2}:\d{2}:\d{2}\sException') {
$Host.UI.RawUI.ForegroundColor = $Host.PrivateData.ErrorForegroundColor
@JLChnToZ
JLChnToZ / cyrillic.user.js
Last active May 17, 2024 12:27
A user script that will transliterates all Latin characters to Cyrillic. Just for fun.
// ==UserScript==
// @name Cyrillic?
// @namespace JLChnToZ
// @grant none
// @version 1.0
// @author -
// @description Transliterates all Latin characters to Cyrillic.
// ==/UserScript==
(() => {
const transliterate = ((latin, cyrillic) => {
using UnityEngine;
#if UNITY_EDITOR
using System;
using System.Linq;
using System.Collections.Generic;
using System.Reflection;
using UnityEditor;
using UnityEditor.Build;
@JLChnToZ
JLChnToZ / SelectionExtension.cs
Last active January 4, 2022 07:47
A tool for temporary holds selections in Unity
using System.Linq;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
using UnityObject = UnityEngine.Object;
public class SelectionExtension: EditorWindow {
[MenuItem("Window/Selection Ex")]
@JLChnToZ
JLChnToZ / UdonAssemblyBuilder.cs
Last active July 30, 2023 19:49
Udon Assembly Low Level Builder for VRChat, helper for generating Udon Assembly programmatically.
using System;
using System.Text;
using System.Text.RegularExpressions;
using System.Collections.Generic;
using System.Reflection;
using UnityEngine;
using VRC.Udon;
using VRC.Udon.Common;
using VRC.Udon.Common.Interfaces;
using VRC.Udon.Graph;
@JLChnToZ
JLChnToZ / JLChnToZ.VRC.CheatDetector.cs
Last active December 15, 2021 19:22
Cheat detector for platform-like games in VRChat.
using System;
using UdonSharp;
using UnityEngine;
using VRC.SDKBase;
using VRC.Udon;
namespace JLChnToZ.VRC {
[UdonBehaviourSyncMode(BehaviourSyncMode.NoVariableSync)]
public class CheatDetector : UdonSharpBehaviour {
[Tooltip("Detects open menu stucking cheat.")]
@JLChnToZ
JLChnToZ / UdonBehaviourInspectorDrawer.cs
Last active September 20, 2021 11:49
Unity Inspector Extension to display/manipulate UdonBehaviours internal state within editor.
using System;
using System.Linq;
using System.Collections.Generic;
using System.Reflection;
using UnityEngine;
using UnityEditor;
using VRC.Udon;
using VRC.Udon.Common.Interfaces;
namespace UInspectorPlus.Udon {
@JLChnToZ
JLChnToZ / FixSceneReference.cs
Last active August 10, 2021 12:11
Editor helper for finding (and try to fix) missing Udon references when updating 2018 project to 2019
using UnityEngine;
using UnityEditor;
using UnityEditor.Experimental.SceneManagement;
using System.Collections.Generic;
using VRC.SDKBase;
using VRC.Udon;
using UnityObject = UnityEngine.Object;
public class FixSceneReference : EditorWindow {
@JLChnToZ
JLChnToZ / MazeGen.cs
Last active August 7, 2021 05:57
Network synchronized random maze generator for VRChat. Powered by UdonSharp.
using System;
using UnityEngine;
using VRC.SDKBase;
using VRC.Udon;
using UdonSharp;
namespace JLChnToZ.VRC.Maze {
[RequireComponent(typeof(MeshFilter)), UdonBehaviourSyncMode(BehaviourSyncMode.Manual)]
public class MazeGen : UdonSharpBehaviour {
// Constants