Skip to content

Instantly share code, notes, and snippets.

@koturn
koturn / Light Volume PBR.shader.shader
Created May 27, 2025 19:57
VRCLightVolumesのサンプルコード(Amplify Shader Editorの出力)を人間向けに読みやすくしたやつ
Shader "Light Volume Samples/Light Volume PBR"
{
Properties
{
_MainTex("Albedo", 2D) = "white" {}
_Color("Color", Color) = (1,1,1,1)
[NoScaleOffset]_MetallicGlossMap("Metal AO Smoothness", 2D) = "white" {}
_Metallic("Metallic", Range( 0 , 1)) = 0
_Glossiness("Smoothness", Range( 0 , 1)) = 1
_OcclusionStrength("AO", Range( 0 , 1)) = 1
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
#if !NET9_0_OR_GREATER
using Lock = object;
#endif // !NET9_0_OR_GREATER
@koturn
koturn / unpack_unitypackage.bash
Created May 8, 2024 14:46
unitypackageを展開するbashスクリプト
#!/bin/bash
set -eu
if [ $# -lt 1 ]; then
echo Invalid arguments 1>&2
echo [USAGE]
echo $0 UNITYPACKAGE
exit 1
fi
@koturn
koturn / ListUtil.cs
Last active March 18, 2025 11:39
List<T>の内部の配列を取得するやつ(with Static Type Cache)
using System;
using System.Collections.Generic;
using System.Reflection;
using System.Reflection.Emit;
namespace Koturn
{
/// <summary>
/// Provides some utility methods of <see cref="List{T}"/>.
@koturn
koturn / ToggleKeywordUtil.cs
Created September 16, 2023 15:18
Unityのシェーダーで[Toggle]が付与されているプロパティのキーワードをC#側から切り替えるやつ(シェーダー側の定義が主)
using System;
using System.Linq.Expressions;
using System.Reflection;
using UnityEditor;
using UnityEngine;
namespace Koturn
{
/// <summary>
@koturn
koturn / MenuHelper.cs
Created September 2, 2023 00:48
https://qiita.com/Swanman/items/279b3b679f3f96a5f925 のリフレクション結果をキャッシュするようにしたやつ
using System;
using System.Linq.Expressions;
using System.Reflection;
using UnityEditor;
namespace Koturn
{
/// <summary>
/// Menu helper
@koturn
koturn / LiltoonCustomShaderMemo.md
Last active August 23, 2023 05:33
lilToonのカスタムシェーダーで躓いたり本体コード読んだときのメモ
<style> details { /* font: 16px "Open Sans", Calibri, sans-serif; */ /* width: 620px; */ } details > summary { padding: 2px 6px; /* width: 15em; */ background-color: #ddd;
@koturn
koturn / LifeGameHSVRotation.shader
Last active January 13, 2021 23:31
ゲーミングライフゲーム
Shader "koturn/GameOfLife"
{
// セルの生存をアルファ値で管理する
// 座標(0, 0)は更新間隔管理に用いており,描画セルかどうかの座標値の判定は省いているので,
// (0, 0)に影響を及ぼさない安定したパターンを初期値として与える必要がある.
Properties
{
_Color ("Cell Color", Color) = (0.0, 1.0, 0.0, 1.0)
_TimeScale ("Time multiplier for HSV rotation", Float) = 0.1
@koturn
koturn / MoveFileByTimestamp.cs
Created November 30, 2020 19:41
VRChatの写真をタイムスタンプで整理するやつ
using System;
using System.IO;
using System.Linq;
namespace MoveFileByTimestamp
{
public class Program
{
private static readonly TimeSpan DefaultOffsetTs;
@koturn
koturn / SingletonTest.cs
Created June 15, 2020 21:11
様々なシングルトンの実装
using System;
namespace Wandbox
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine(Foo.Instance.Name);
Console.WriteLine(Bar.Instance.Name);