Skip to content

Instantly share code, notes, and snippets.

@koturn
koturn / compare_original_custom.sql
Created October 4, 2025 00:24
lilToonのシェーダーリソースのDB(SQLite3)を作成するスクリプト
SELECT
i.base_name,
c.base_name AS base_name_custom,
sm.member_name,
i.file_name AS file_name_internal,
c.file_name AS file_name_container,
i.shader_name,
c.shader_name_fmt,
i.tagval_render_type,
c.tagval_render_type AS tagval_render_type_custom,
@koturn
koturn / sqlite3_csvimport.sh
Last active October 4, 2025 11:08
SQLite3でNULLを考慮してCSVインポートを行うためのラッパースクリプト
#!/bin/bash
set -eu
import_schema='imp'
##
## Show help text of this script.
##
## stdout: Help text of this program.
@koturn
koturn / CalcNormal.md
Created July 17, 2025 19:10
Tetrahedron Teqniqueの導出

陰関数の法線ベクトル

陰関数 $f$$f: \mathbb{R}^3 \mapsto \mathbb{R}$ )の正規化法線ベクトル $\boldsymbol{n}$$\boldsymbol{n} \in \mathbb{R^3}$ ) は下記のように求められる.

$$ \begin{align} \boldsymbol{n} &= normalize(\nabla f( \boldsymbol{p} )) \ &= normalize \begin{pmatrix} \dfrac{\partial f(\boldsymbol{p})}{\partial x} \

@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;