Skip to content

Instantly share code, notes, and snippets.

View JLChnToZ's full-sized avatar
🫥
Unemployed

Jeremy Lam aka. Vistanz JLChnToZ

🫥
Unemployed
View GitHub Profile
// Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)'
Shader "Debuggers/AudioLinkLocator" {
Properties {
_Scale ("Distance", Range(0.0001, 10)) = 1
}
SubShader {
Tags {
"RenderType" = "Opaque"
"Queue" = "Overlay"
@JLChnToZ
JLChnToZ / BakeryAutoMigrate.cs
Created September 4, 2024 15:34
One-Click migrates all supported baked lights on scene to use Bakery.
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.SceneManagement;
using UnityEditor;
public static class BakeryAutoMigrate {
static Texture2D spotCookie;
[MenuItem("Bakery/Utilities/Migrate and Adjust Lights", priority = 60)]
#if UNITY_EDITOR
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using TMPro;
using UnityEditor;
using QvPen.UdonScript;
using QvPen.UdonScript.UI;
public class QvPenTMProMigrator {
@JLChnToZ
JLChnToZ / AutoPasswordPrompt.cs
Last active March 11, 2024 11:18
Prompt you to enter the keystore password if you forget before starting a new Android build in Unity.
using UnityEngine;
using UnityEditor;
using UnityEditor.Build;
public class AutoPasswordPrompt : EditorWindow {
[InitializeOnLoadMethod]
static void Register() => BuildPlayerWindow.RegisterBuildPlayerHandler(BuildHandler);
static bool IsUnfilled() =>
Shader "Unlit/PolyRhythmVisualizer" {
Properties {
_TimeCode ("Input Time", Float) = 0
_OuterRingFreq ("Outer Ring Frequency", Float) = 1
_InnerRingFreq ("Inner Ring Frequency", Float) = 0.922
_RingCount ("Ring Count", Int) = 35
_VibrantFreq ("Vibrant Frequency", Float) = 2
_Vibrant ("Vibrant", Range(0, 1)) = 0.5
_Decay ("Decay", Range(0, 10)) = 2
[Header(Cosine Gradiant)]
@JLChnToZ
JLChnToZ / Limitless.cs
Last active May 17, 2024 12:25
The dynamic access pass to any methods, properties and fields of any types and instances in C#.
using System;
using System.Collections;
using System.Collections.Generic;
using System.Dynamic;
using System.Reflection;
using System.Runtime.CompilerServices;
namespace JLChnToZ.CommonUtils.Dynamic {
using static LimitlessUtilities;
/// <summary>
@JLChnToZ
JLChnToZ / ObjectSnapshot.cs
Last active May 17, 2024 12:26
Take snapshots of properties of objects/components on play mode and re-apply them when stopped.
using System;
using System.Linq;
using System.Reflection;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEditor;
using UnityEditor.SceneManagement;
using UnityObject = UnityEngine.Object;
@JLChnToZ
JLChnToZ / BoneEditorWindow.cs
Last active December 11, 2023 16:34
Unity's missing Skinned Mesh Bone Reference Editor
using System;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Rendering;
using UnityEditor;
using UnityEditorInternal;
public class BoneEditorWindow : EditorWindow {
const string BASE_MENU_PATH = "CONTEXT/" + nameof(SkinnedMeshRenderer) + "/";
const string MENU_PATH = BASE_MENU_PATH + "Edit Bone References";
@JLChnToZ
JLChnToZ / MeshCombinerWindow.cs
Last active April 1, 2023 16:27
A clean mesh combiner for Unity
/**
* The MIT License (MIT)
*
* Copyright (c) 2023 Jeremy Lam aka. Vistanz
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
@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;