hadr_01 ã¨ããæã®ãªãã¸ã§ã¯ãã«ä½¿ããã¦ãã MADFINGER-Lightmap-Unlit-Wind(ãã¡ã¤ã«å㯠MADFINGER-Lightmap-Unlit-Wind.shader )ã¨ããã·ã§ã¼ãã®è¨è¿°ãè¦ã¦ã¿ã¾ããã
Shader
Shader "MADFINGER/Environment/Lightmap + Wind" {
ã·ã§ã¼ãã®é¸ææãªã¹ãã«è¡¨ç¤ºãããååã / ã§åºåãã¨é層æ§é ã«ãªãã¾ãã
Properties
Properties { _MainTex ("Base (RGB) Gloss (A)", 2D) = "white" {} _Wind("Wind params",Vector) = (1,1,1,1) _WindEdgeFlutter("Wind edge fultter factor", float) = 0.5 _WindEdgeFlutterFreqScale("Wind edge fultter freq scale",float) = 0.5 }
Propertiesã«è¨è¼ãããå
容ã¯Inspectorã«è¡¨ç¤ºããã¾ãã
対å¿ããããã¥ã¡ã³ã
Unity - ShaderLab syntax: Properties
http://unity3d.com/support/documentation/Components/SL-Properties.html
SubShader
SubShader {
SubShaderã§ã¯ã¬ã³ããªã³ã°æã®è¨å®ãè¡ãã¾ãã
対å¿ããããã¥ã¡ã³ã
Unity - ShaderLab syntax: SubShader
http://unity3d.com/support/documentation/Components/SL-SubShader.html
Tags
Tags {"Queue"="Transparent" "RenderType"="Transparent" "LightMode"="ForwardBase"}
Tagsã® "Queue"= ã§ã¯ã¬ã³ããªã³ã°ã®ãªã¼ãã¼é ãæå®ãã¾ãã
ããã©ã«ãã§ä»¥ä¸ã®ãã®ãå®ç¾©ããã¦ãã¾ãã
å®æ° | å¤ |
---|---|
Background | 1000 |
Geometry | 2000 |
Transparent | 3000 |
Overlay | 4000 |
以ä¸ã®æ§ãªæ¸ãæ¹ãå¯è½ã§ãã
Tags { "Queue" = "Geometry+1" }
対å¿ããããã¥ã¡ã³ã
Unity - ShaderLab syntax: SubShader Tags
http://unity3d.com/support/documentation/Components/SL-SubshaderTags.html
LOD
LOD 100
LOD(Level of Detail)ã®è¨å®ã
対å¿ããããã¥ã¡ã³ã
Unity - Shader Level of Detail
http://unity3d.com/support/documentation/Components/SL-ShaderLOD.html
Blend
Blend SrcAlpha OneMinusSrcAlpha
ãã¬ã³ãã®è¨å®ã
対å¿ããããã¥ã¡ã³ã
Unity - ShaderLab syntax: Blending
http://unity3d.com/support/documentation/Components/SL-Blend.html
Cull
Cull Off ZWrite Off
ã«ãªã³ã°ã®è¨å®ã
CGINCLUDEãENDCG
CGINCLUDE #include "UnityCG.cginc" #include "TerrainEngine.cginc" sampler2D _MainTex; float4 _MainTex_ST; samplerCUBE _ReflTex; #ifndef LIGHTMAP_OFF float4 unity_LightmapST; sampler2D unity_Lightmap; #endif float _WindEdgeFlutter; float _WindEdgeFlutterFreqScale; (ä¸ç¥) o.spec = v.color; #ifndef LIGHTMAP_OFF o.lmap = v.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; #endif return o; } ENDCG
Cgããã°ã©ã ã®ãããã¯ã
Pass
Pass {
ã¬ã³ããªã³ã°å¦çã®è¨è¿°ã®ã¡ã¤ã³é¨åã
対å¿ããããã¥ã¡ã³ã
Unity - ShaderLab syntax: Pass
http://unity3d.com/support/documentation/Components/SL-Pass.html
#pragma vertex vert
Vertex(é ç¹)ã·ã§ã¼ãã«ä½¿ç¨ããé¢æ°ã« vert() ãæå®ã
#pragma fragment frag
Fragment(ãã©ã°ã¡ã³ã)ã·ã§ã¼ãã«ä½¿ç¨ããé¢æ°ã« vert() ãæå®ã
#pragma fragmentoption ARB_precision_hint_fastest
Fragment(ãã©ã°ã¡ã³ã)ã·ã§ã¼ãã®ãªãã·ã§ã³ã« ARB_precision_hint_fastest ãæå®ã
詳ããã¯こちらãåç
§ã
対å¿ããããã¥ã¡ã³ã
Unity - Writing vertex and fragment shaders
http://unity3d.com/support/documentation/Components/SL-ShaderPrograms.html
ããã§ã·ã§ã¼ãèªä½ã®è§£èª¬ããããã¨ããã§ããã·ã§ã¼ãã«ã¤ãã¦å ¨ç¶ç¥ããªãèªåã解æããã«ã¯ã¡ãã£ã¨è·ãéãããªã®ã§ä¸åº¦ãUnityã§ã®ã·ã§ã¼ãã®ä½¿ãæ¹ãã¡ããã¨åå¼·ãã¦ããæ¹ãã¦è§£æãã¦ã¿ããã¨æãã¾ãã
åãæ¢ãããUnityã§ã¯ã·ã§ã¼ããCg / HLSLã§è¨è¿°ãã¦ãã¿ãããªã®ã§Unityå ¬å¼ã®ããã¥ã¡ã³ãé¡ã¨åããã¦ãNVIDIAã®ãµã¤ãã§Cgã«ã¤ãã¦ãåå¼·ãã¦ãããæ¹ãè¯ãããªï¼ã¨æã£ã¦ãã¾ã(ãã£ã±ããGPU Gemèªãã©ãã¹ãããªãï¼)ã
å ã¿ã«ãCgã¯NVIDIAãä½ã£ãCè¨èªã©ã¤ã¯ã«è¨è¿°ãå¯è½ãªã·ã§ã¼ãè¨èªã
Cg (ããã°ã©ãã³ã°è¨èª) - Wikipedia
http://ja.wikipedia.org/wiki/Cg_%28%E3%83%97%E3%83%AD%E3%82%B0%E3%83%A9%E3%83%9F%E3%83%B3%E3%82%B0%E8%A8%80%E8%AA%9E%29
HLSLã¯ãã¤ã¯ãã½ãããéçºããCgã¨åæ§ã®ã·ã§ã¼ãè¨èª
High Level Shader Language - Wikipedia
http://ja.wikipedia.org/wiki/High_Level_Shader_Language
Unityå ¬å¼ã®ã·ã§ã¼ãé¢é£ã®ãã¥ã¼ããªã¢ã«
Unity - Shaders: ShaderLab & Fixed Function shaders
http://unity3d.com/support/documentation/Manual/ShaderTut1.html
Unity - Shaders: Vertex and Fragment Programs
http://unity3d.com/support/documentation/Manual/ShaderTut2.html
Unity - Writing Surface Shaders
http://unity3d.com/support/documentation/Components/SL-SurfaceShaders.html
Unity - Surface Shader Examples
http://unity3d.com/support/documentation/Components/SL-SurfaceShaderExamples.html
Unity - Surface Shader Lighting Examples
http://unity3d.com/support/documentation/Components/SL-SurfaceShaderLightingExamples.html
é¢é£æ å ±
Unity - Shader Reference
http://unity3d.com/support/documentation/Components/SL-Reference.html
Unity製ã®ãã¤ã¯ãªãªãã£ã²ã¼ã ãSHADOWGUNãã®ã¹ãã¼ã¸ãã¼ã¿ãå ¬é - å¼·ç«ã§é²ã
http://d.hatena.ne.jp/nakamura001/20120324/1332602780