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 / ShaderKeywordCollector.cs
Last active March 13, 2024 04:46
Unityプロジェクト内に存在するすべてのマテリアルのシェーダーキーワードをShaderVariantCollectionへ登録するツール (Unity2022 / URP14.0.10)
namespace MyTool
{
using System;
using UnityEditor;
using UnityEngine;
using System.Linq;
using UnityEngine.Rendering;
public class ShaderKeywordCollector : EditorWindow
{
@rngtm
rngtm / chocolateOcean.glsl
Created February 14, 2024 00:10
チョコレートの海シェーダー (GLSL)
// Original : https://www.shadertoy.com/view/MdXyzX
// afl_ext 2017-2023
// Now with 2023 refresh
// MIT License
// Use your mouse to move the camera around! Press the Left Mouse Button on the image to look around!
#define DRAG_MULT 0.28 // changes how much waves pull on the water
#define WATER_DEPTH 1.0 // how deep is the water
#define CAMERA_HEIGHT 1.5 // how high the camera should be
@rngtm
rngtm / GraphPreviewNode.cs
Created October 22, 2018 11:48
ShaderGraph - GraphPreviewNode
using UnityEngine;
using UnityEditor.ShaderGraph;
using System.Reflection;
[Title("Utility", "Graph Preview")]
public class GraphPreviewNode : CodeFunctionNode
{
protected override MethodInfo GetFunctionToConvert()
{
return GetType().GetMethod("MyCustomFunction",
@rngtm
rngtm / DomainWarpingNode.cs
Last active February 8, 2024 03:19
ドメインワーピング( http://www.iquilezles.org/www/articles/warp/warp.htm ) をシェーダーグラフで使うためにカスタムノード化したものです
using UnityEngine;
using UnityEditor.ShaderGraph;
using System.Reflection;
/// <summary>
/// ドメインワーピング(http://www.iquilezles.org/www/articles/warp/warp.htm)
/// </summary>
[Title("Custom", "Domain Warping(@iquilezles)")]
public class DomainWarpingNode : CodeFunctionNode
{
@rngtm
rngtm / TriangleNode.cs
Last active February 8, 2024 03:19
正三角形タイルを出力する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 / HexagonNode.cs
Last active February 8, 2024 03:19
六角形タイルを作る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 / GaussianBlur.shader
Last active August 28, 2023 23:54
Spriteにガウシアンブラーを適用した結果をMeshRendererで表示するスクリプトとシェーダー (ブラーの復習に書いた)
Shader "Hidden/GaussianBlur"
{
Properties
{
_MainTex ("Texture", 2D) = "white" {}
_Variance ("Variance", Float) = 1.0
_Range ("Range (px)", Float) = 5.0
_GaussianSum ("Gaussian Sum", Float) = 1.0
_KernelSize ("Kernel Size", Float) = 5
}
@rngtm
rngtm / ColorAndDepthPipeline.cs
Last active August 13, 2023 10:24
UnityのSRPを組む勉強 : _CameraColorAttachmentと_CameraDepthAttachmentを自前で設定するSRP
using UnityEngine;
using UnityEngine.Rendering;
namespace Study
{
public class ColorAndDepthPipeline : RenderPipeline
{
private static readonly int ColorAttachmentId = Shader.PropertyToID("_CameraColorAttachment");
private static readonly int DepthAttachmentId = Shader.PropertyToID("_CameraDepthAttachment");
private static UnityEngine.Experimental.Rendering.GraphicsFormat ColorFormat = SystemInfo.GetGraphicsFormat(UnityEngine.Experimental.Rendering.DefaultFormat.LDR);
@rngtm
rngtm / SimpleTess.shader
Created August 6, 2023 10:58
シンプルなテッセレーションシェーダー
Shader "Unlit/SimpleTess"
{
Properties
{
_MainTex ("Texture", 2D) = "white" {}
_TessFactor ("Tess Factor", Vector) = (1, 1, 1, 1) // テセレーション係数 (メッシュをどれくらい分割するかを決定する)
}
SubShader
{
Tags
@rngtm
rngtm / CustomImageEffect.shader
Last active June 26, 2023 22:41
URP 10.7.0でのフルスクリーンエフェクトでのRenderBufferのロード・ストア最適化の検証
Shader "Hidden/CustomImageEffect"
{
Properties
{
_MainTex ("Texture", 2D) = "white" {}
}
SubShader
{
// No culling or depth
Cull Off ZWrite Off ZTest Always