Skip to content

Instantly share code, notes, and snippets.

View rngtm's full-sized avatar
💭
I may be slow to respond.

rngtm rngtm

💭
I may be slow to respond.
View GitHub Profile
@rngtm
rngtm / HexagonNode.cs
Last active March 5, 2025 14:46
六角形タイルを作るShaderGraphカスタムノード
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor.ShaderGraph;
using System.Reflection;
[Title("Distance", "Hexagon")]
public class HexagonNode : CodeFunctionNode
{
public HexagonNode()
@rngtm
rngtm / GenerateManyPlane.cs
Created December 21, 2018 14:21
板を1メッシュで大量に生成するC#スクリプト
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
#if UNITY_EDITOR
using UnityEditor;
/// <summary>
/// エディター拡張
/// </summary>
@rngtm
rngtm / TriangleNode.cs
Last active August 24, 2025 22:39
正三角形タイルを出力するShaderGraphカスタムノード (Unity2021ver : https://gist.github.com/rngtm/2ce62f55c4e80bdf5570402bd4d66dc7)
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor.ShaderGraph;
using System.Reflection;
[Title("Distance", "Triangle")]
public class TriangleNode : CodeFunctionNode
{
public TriangleNode()
@rngtm
rngtm / random_walk_spread.pde
Last active January 5, 2019 16:29
ランダムウォークを複数回描画してpng出力するprocessingコード(.pde)
final boolean isSave = true; // save as png
final int FrameN = 4;
final int N = 5000; // random walk number
final int alpha = 15; // line alpha
// random walk parameter
final float startRadius = 45;
final float addRadius = 45;
@rngtm
rngtm / Particle-AlphaBlended-Clamp.shader
Created January 9, 2020 14:53
TEXCOORD0.zで2値化するParticleSystem用シェーダー。 Unity2017.4.24f1で動作確認済み
Shader "Custom/Particles/Alpha Blended - Clamp(TEXCOORD0.z)" {
Properties{
_MainTex("Grayscale Texture", 2D) = "white" {}
}
Category{
Tags { "Queue" = "Transparent" "IgnoreProjector" = "True" "RenderType" = "Transparent" "PreviewType" = "Plane" }
Blend SrcAlpha OneMinusSrcAlpha // Alpha Blended
ColorMask RGB
Cull Off Lighting Off ZWrite Off
@rngtm
rngtm / TimeFrameConverter.cs
Last active March 5, 2020 00:08
時間 <->フレーム数 の相互変換ツール
using UnityEngine;
using UnityEditor;
namespace Tools
{
public class TimeFrameConverter : EditorWindow
{
static private Color darkColor = new Color(216f , 222f , 226f, 255f) / 255f;
static private GUIStyle rowStyle = null;
static private GUIStyle valueBoxStyle = null;
@rngtm
rngtm / HexagonTile.hlsl
Last active May 10, 2024 04:56
Unity ShaderGraphのCustomFunctionで六角形タイルを作るためのHLSLファイル
void HexagonTile_float(
float2 UV,
float Scale,
out float Hexagon, // 六角形
out float2 HexPos, // 六角形の位置
out float2 HexUV, // 六角形内のUVを出力
out float2 HexIndex // 六角形の番号
)
{
///////////////////////////////////////////////////////////////////
@rngtm
rngtm / MobiusRing
Last active February 1, 2021 12:56
Houdini VEX でメビウスの輪
// tの分割数
int tDiv = 200;
// r
float rMin = -1; // rの最小値
float rMax = 1; // rの最大値
int rDiv = 2; // rの分割数
// t
float tMin = 0; // tの最小値
@rngtm
rngtm / TriangleTile.hlsl
Created July 17, 2021 03:47
Unity2021 ShaderGraph用 三角形タイル カスタムノード
void TriangleTile_float(
float2 UV,
float Scale,
out float Triangle,
out float2 TrianglePosition
)
{
#define N Scale
float2 p = UV;
p.x *= 0.86602; // sqrt(3)/2倍
@rngtm
rngtm / GLSLSound 01
Last active November 23, 2021 06:24
GLSL Sound : 遺跡っぽいBGM
float Tone(int i)
{
return 420.0 * exp2(float(i + 2) / 12.0);
}
int g_key = 0;
#define PI acos(-1.0)
float SinWave(float time, float freq)
{