- name
- intent
- problem/motivation
- solution
- structure
- code
- consequences & trade-offs
| // When creating shaders for Lightweight Pipeline you can you the ShaderGraph which is super AWESOME! | |
| // However, if you want to author shaders in shading language you can use this simplified version as a base. | |
| // Please not this should be only use for reference only. | |
| // It doesn't match neither performance not feature completeness of Lightweight Pipeline Standard shader. | |
| Shader "LightweightPipeline/Physically Based Example" | |
| { | |
| Properties | |
| { | |
| // Specular vs Metallic workflow | |
| [HideInInspector] _WorkflowMode("WorkflowMode", Float) = 1.0 |
| using UnityEngine; | |
| public static class Colors | |
| { | |
| public static readonly Color AbsoluteZero = new Color32( 0, 72, 186, 255 ); | |
| public static readonly Color Acajou = new Color32( 76, 47, 39, 255 ); | |
| public static readonly Color AcidGreen = new Color32( 176, 191, 26, 255 ); | |
| public static readonly Color Aero = new Color32( 124, 185, 232, 255 ); | |
| public static readonly Color AeroBlue = new Color32( 201, 255, 229, 255 ); | |
| public static readonly Color AfricanViolet = new Color32( 178, 132, 190, 255 ); |
| using UnityEngine; | |
| public static class SpriteExtensiton | |
| { | |
| /// <summary> | |
| /// Convert Texture2D To Sprite | |
| /// </summary> | |
| /// <param name="texture"></param> | |
| /// <returns></returns> | |
| public static Sprite Texture2DToSprite(this Texture2D texture) |
| using System.Collections; | |
| using System.Collections.Generic; | |
| using UnityEngine; | |
| //------------------------------------- | |
| // simple ink paintスクリプト | |
| // ColliderとRendererは必要 | |
| [RequireComponent(typeof(Renderer))] | |
| [RequireComponent(typeof(Collider))] | |
| public class SimpleInkPaint : MonoBehaviour { |
| Shader "Unlit/SimpleInkPaint" | |
| { | |
| Properties{ | |
| _MainTex("MainTex", 2D) = "white" // メインテクスチャ | |
| _Brush("Brush", 2D) = "white" // ブラシテクスチャ | |
| _BrushScale("BrushScale", FLOAT) = 0.1 // ブラシサイズ | |
| _ControlColor("ControlColor", VECTOR) = (0, 0, 0, 0) // ブラシの色 | |
| _PaintUV("Hit UV Position", VECTOR) = (0, 0, 0, 0) // ブラシで塗りたい位置 | |
| } |
| Shader "Custom/Cook-Torrance" { | |
| Properties { | |
| _Color ("Color", Color) = (1,1,1,1) | |
| _MainTex ("Albedo (RGB)", 2D) = "white" {} | |
| _BumpMap("Normal Map", 2D) = "bump" {} | |
| _Metallic("Metallic", Range(0,1)) = 0.5 | |
| _MetallicTex("Metallic", 2D) = "white" {} | |
| _Roughness("Roughness", Range(0.000000001,1)) = 0.5 | |
| _RoughnessTex("Roughness", 2D) = "white" {} | |
| _Fresnel("Fresnel Value", Float) = 0.028 |
| Shader "Diffuse Lightmap" { | |
| Properties { | |
| _MainTex ("Texture 1", 2D) = "white" {} | |
| } | |
| SubShader { | |
| Tags { "RenderType" = "Opaque" } | |
| Pass { |
| Shader "Custom/ImageEffectBase" { | |
| Properties { | |
| _MainTex ("Base (RGB)", 2D) = "white" {} | |
| } | |
| CGINCLUDE | |
| #include "UnityCG.cginc" | |
| sampler2D _MainTex; | |
| half4 _MainTex_TexelSize; | |
| Shader "Custom/VertexBlendMaskedCleanEdges" { | |
| Properties | |
| { | |
| _Over ("Over", 2D) = "white" {} | |
| _Under ("Under", 2D) = "white" {} | |
| _Mask ("Mask", 2D) = "white" {} | |
| _Bias ("Edge Bias", Range(0.5, 30.0)) = 4.0 | |
| _Edge ("Edge Sharpness", Float) = 10.0 | |
| _Fall ("Blend Falloff", Float) = 1.0 | |
| } |