From fc6de82e75310b4c007d80753a5f58e6692f4855 Mon Sep 17 00:00:00 2001 From: chai Date: Tue, 13 Oct 2020 10:33:05 +0800 Subject: +misc --- .../UMotion/UMotionEditor/Shaders/CameraLit.shader | 146 ++++++++++----------- .../UMotionEditor/Shaders/ColorUnlit.shader | 80 +++++------ .../Shaders/ColorUnlitTransparent.shader | 84 ++++++------ .../UMotionEditor/Shaders/UnlitDashedLine.shader | 140 ++++++++++---------- .../UMotion/UMotionEditor/Shaders/UnlitLine.shader | 126 +++++++++--------- .../UMotionEditor/Shaders/VertexColorUnlit.shader | 62 ++++----- .../UMotion/UMotionEditor/Shaders/WiresOnly.shader | 130 +++++++++--------- 7 files changed, 384 insertions(+), 384 deletions(-) (limited to 'Assets/ThirdParty/UMotion/UMotionEditor/Shaders') diff --git a/Assets/ThirdParty/UMotion/UMotionEditor/Shaders/CameraLit.shader b/Assets/ThirdParty/UMotion/UMotionEditor/Shaders/CameraLit.shader index 6ca491b3..f9dd2196 100644 --- a/Assets/ThirdParty/UMotion/UMotionEditor/Shaders/CameraLit.shader +++ b/Assets/ThirdParty/UMotion/UMotionEditor/Shaders/CameraLit.shader @@ -1,73 +1,73 @@ -Shader "UMotion Editor/Camera Lit" -{ - Properties - { - _Color("Main Color (RGB)", color) = (1, 1, 1, 1) - _WireColor("Wire Color (RGB) Trans (A)", color) = (0, 0, 0, 1) - _WireSize("Wire Size", Range(0, 4)) = 0.9 - } - - SubShader - { - Tags { "RenderType" = "Opaque" "IgnoreProjector"="True" } - LOD 100 - - Pass - { - CGPROGRAM - #pragma vertex vert - #pragma fragment frag - #pragma target 3.0 - - #include "UnityCG.cginc" - - fixed4 _Color; - fixed4 _WireColor; - half _WireSize; - - struct vInput - { - float4 vertex : POSITION; - half4 texcoord : TEXCOORD0; - float3 normal : NORMAL; - }; - - struct vOutput - { - float4 pos : SV_POSITION; - fixed3 wirecoord : TEXCOORD1; - float3 lambert : TEXCOORD2; - }; - - vOutput vert(vInput i) - { - vOutput o; - - o.pos = UnityObjectToClipPos(i.vertex); - - o.wirecoord = fixed3(floor(i.texcoord.x), frac(i.texcoord.x) * 10, i.texcoord.y); - - float3 viewDir = normalize(WorldSpaceViewDir(i.vertex)); - float3 worldNormal = normalize(UnityObjectToWorldNormal(i.normal)); - o.lambert = saturate(dot(viewDir, worldNormal)); - - return o; - } - - fixed4 frag(vOutput i) : SV_Target - { - fixed4 outColor; - outColor.rgb = i.lambert * _Color; - outColor.a = 1.0; - - half3 width = abs(ddx(i.wirecoord.xyz)) + abs(ddy(i.wirecoord.xyz)); - half3 smoothed = smoothstep(half3(0, 0, 0), width * _WireSize, i.wirecoord.xyz); - half wireAlpha = min(min(smoothed.x, smoothed.y), smoothed.z); - - return lerp(lerp(outColor, _WireColor, _WireColor.a), outColor, wireAlpha); - } - - ENDCG - } //Pass - } //SubShader -} //Shader +Shader "UMotion Editor/Camera Lit" +{ + Properties + { + _Color("Main Color (RGB)", color) = (1, 1, 1, 1) + _WireColor("Wire Color (RGB) Trans (A)", color) = (0, 0, 0, 1) + _WireSize("Wire Size", Range(0, 4)) = 0.9 + } + + SubShader + { + Tags { "RenderType" = "Opaque" "IgnoreProjector"="True" } + LOD 100 + + Pass + { + CGPROGRAM + #pragma vertex vert + #pragma fragment frag + #pragma target 3.0 + + #include "UnityCG.cginc" + + fixed4 _Color; + fixed4 _WireColor; + half _WireSize; + + struct vInput + { + float4 vertex : POSITION; + half4 texcoord : TEXCOORD0; + float3 normal : NORMAL; + }; + + struct vOutput + { + float4 pos : SV_POSITION; + fixed3 wirecoord : TEXCOORD1; + float3 lambert : TEXCOORD2; + }; + + vOutput vert(vInput i) + { + vOutput o; + + o.pos = UnityObjectToClipPos(i.vertex); + + o.wirecoord = fixed3(floor(i.texcoord.x), frac(i.texcoord.x) * 10, i.texcoord.y); + + float3 viewDir = normalize(WorldSpaceViewDir(i.vertex)); + float3 worldNormal = normalize(UnityObjectToWorldNormal(i.normal)); + o.lambert = saturate(dot(viewDir, worldNormal)); + + return o; + } + + fixed4 frag(vOutput i) : SV_Target + { + fixed4 outColor; + outColor.rgb = i.lambert * _Color; + outColor.a = 1.0; + + half3 width = abs(ddx(i.wirecoord.xyz)) + abs(ddy(i.wirecoord.xyz)); + half3 smoothed = smoothstep(half3(0, 0, 0), width * _WireSize, i.wirecoord.xyz); + half wireAlpha = min(min(smoothed.x, smoothed.y), smoothed.z); + + return lerp(lerp(outColor, _WireColor, _WireColor.a), outColor, wireAlpha); + } + + ENDCG + } //Pass + } //SubShader +} //Shader diff --git a/Assets/ThirdParty/UMotion/UMotionEditor/Shaders/ColorUnlit.shader b/Assets/ThirdParty/UMotion/UMotionEditor/Shaders/ColorUnlit.shader index dc4654a9..50815eef 100644 --- a/Assets/ThirdParty/UMotion/UMotionEditor/Shaders/ColorUnlit.shader +++ b/Assets/ThirdParty/UMotion/UMotionEditor/Shaders/ColorUnlit.shader @@ -1,41 +1,41 @@ -Shader "UMotion Editor/Color Unlit" -{ - Properties - { - // Color property for material inspector, default to white - _Color ("Main Color", Color) = (1,1,1,1) - } - SubShader - { - Tags { "RenderType"="Opaque" "IgnoreProjector"="True" } - LOD 100 - - Pass - { - CGPROGRAM - #pragma vertex vert - #pragma fragment frag - - #include "UnityCG.cginc" - - // vertex shader - // this time instead of using "appdata" struct, just spell inputs manually, - // and instead of returning v2f struct, also just return a single output - // float4 clip position - float4 vert (float4 vertex : POSITION) : SV_POSITION - { - return UnityObjectToClipPos(vertex); - } - - // color from the material - fixed4 _Color; - - // pixel shader, no inputs needed - fixed4 frag () : SV_Target - { - return _Color; // just return it - } - ENDCG - } - } +Shader "UMotion Editor/Color Unlit" +{ + Properties + { + // Color property for material inspector, default to white + _Color ("Main Color", Color) = (1,1,1,1) + } + SubShader + { + Tags { "RenderType"="Opaque" "IgnoreProjector"="True" } + LOD 100 + + Pass + { + CGPROGRAM + #pragma vertex vert + #pragma fragment frag + + #include "UnityCG.cginc" + + // vertex shader + // this time instead of using "appdata" struct, just spell inputs manually, + // and instead of returning v2f struct, also just return a single output + // float4 clip position + float4 vert (float4 vertex : POSITION) : SV_POSITION + { + return UnityObjectToClipPos(vertex); + } + + // color from the material + fixed4 _Color; + + // pixel shader, no inputs needed + fixed4 frag () : SV_Target + { + return _Color; // just return it + } + ENDCG + } + } } \ No newline at end of file diff --git a/Assets/ThirdParty/UMotion/UMotionEditor/Shaders/ColorUnlitTransparent.shader b/Assets/ThirdParty/UMotion/UMotionEditor/Shaders/ColorUnlitTransparent.shader index 536f40bc..de069c03 100644 --- a/Assets/ThirdParty/UMotion/UMotionEditor/Shaders/ColorUnlitTransparent.shader +++ b/Assets/ThirdParty/UMotion/UMotionEditor/Shaders/ColorUnlitTransparent.shader @@ -1,43 +1,43 @@ -Shader "UMotion Editor/Color Unlit Transparent" -{ - Properties - { - // Color property for material inspector, default to white - _Color ("Main Color", Color) = (1,1,1,1) - } - SubShader - { - Tags { "RenderType"="Transparent" "IgnoreProjector"="True" } - LOD 100 - ZWrite Off - Blend SrcAlpha OneMinusSrcAlpha - - Pass - { - CGPROGRAM - #pragma vertex vert - #pragma fragment frag - - #include "UnityCG.cginc" - - // vertex shader - // this time instead of using "appdata" struct, just spell inputs manually, - // and instead of returning v2f struct, also just return a single output - // float4 clip position - float4 vert (float4 vertex : POSITION) : SV_POSITION - { - return UnityObjectToClipPos(vertex); - } - - // color from the material - fixed4 _Color; - - // pixel shader, no inputs needed - fixed4 frag () : SV_Target - { - return _Color; // just return it - } - ENDCG - } - } +Shader "UMotion Editor/Color Unlit Transparent" +{ + Properties + { + // Color property for material inspector, default to white + _Color ("Main Color", Color) = (1,1,1,1) + } + SubShader + { + Tags { "RenderType"="Transparent" "IgnoreProjector"="True" } + LOD 100 + ZWrite Off + Blend SrcAlpha OneMinusSrcAlpha + + Pass + { + CGPROGRAM + #pragma vertex vert + #pragma fragment frag + + #include "UnityCG.cginc" + + // vertex shader + // this time instead of using "appdata" struct, just spell inputs manually, + // and instead of returning v2f struct, also just return a single output + // float4 clip position + float4 vert (float4 vertex : POSITION) : SV_POSITION + { + return UnityObjectToClipPos(vertex); + } + + // color from the material + fixed4 _Color; + + // pixel shader, no inputs needed + fixed4 frag () : SV_Target + { + return _Color; // just return it + } + ENDCG + } + } } \ No newline at end of file diff --git a/Assets/ThirdParty/UMotion/UMotionEditor/Shaders/UnlitDashedLine.shader b/Assets/ThirdParty/UMotion/UMotionEditor/Shaders/UnlitDashedLine.shader index 9e0fb815..37798944 100644 --- a/Assets/ThirdParty/UMotion/UMotionEditor/Shaders/UnlitDashedLine.shader +++ b/Assets/ThirdParty/UMotion/UMotionEditor/Shaders/UnlitDashedLine.shader @@ -1,70 +1,70 @@ -Shader "UMotion Editor/Unlit Dashed Line" -{ - Properties - { - _Color("Line Color (RGB) Trans (A)", color) = (0, 0, 0, 1) - _Thickness("Line Thikness", Range(0, 4)) = 0.9 - _DashFrequency("Dash Frequency", Range(0, 150)) = 100 - } - - SubShader - { - Tags {"Queue"="Transparent" "RenderType"="Transparent" "IgnoreProjector"="True" "DisableBatching"="True" } - LOD 100 - - ZWrite Off - Blend SrcAlpha OneMinusSrcAlpha - Cull Off - - Pass - { - CGPROGRAM - #pragma vertex vert - #pragma fragment frag - #pragma target 3.0 - - #include "UnityCG.cginc" - - fixed4 _Color; - half _Thickness; - half _DashFrequency; - - struct vInput - { - float4 vertex : POSITION; - half4 texcoord : TEXCOORD0; - }; - - struct vOutput - { - float4 pos : SV_POSITION; - float2 uv : TEXCOORD0; - }; - - vOutput vert(vInput i) - { - vOutput o; - - o.pos = UnityObjectToClipPos(i.vertex); - - o.uv = i.texcoord.xy; - o.uv.x *= length(float3(unity_ObjectToWorld[0].z, unity_ObjectToWorld[1].z, unity_ObjectToWorld[2].z)); - - return o; - } - - fixed4 frag(vOutput i) : SV_Target - { - half2 mass = half2(sin(i.uv.x * _DashFrequency), i.uv.y); - - half2 width = abs(ddx(mass)) + abs(ddy(mass)); - half2 smoothed = smoothstep(half2(0, 0), width * _Thickness, mass.xy); - half alpha = max(smoothed.x, smoothed.y); - - return fixed4(_Color.x, _Color.y, _Color.z, 1 - alpha); - } - - ENDCG - } //Pass - } //SubShader -} //Shader +Shader "UMotion Editor/Unlit Dashed Line" +{ + Properties + { + _Color("Line Color (RGB) Trans (A)", color) = (0, 0, 0, 1) + _Thickness("Line Thikness", Range(0, 4)) = 0.9 + _DashFrequency("Dash Frequency", Range(0, 150)) = 100 + } + + SubShader + { + Tags {"Queue"="Transparent" "RenderType"="Transparent" "IgnoreProjector"="True" "DisableBatching"="True" } + LOD 100 + + ZWrite Off + Blend SrcAlpha OneMinusSrcAlpha + Cull Off + + Pass + { + CGPROGRAM + #pragma vertex vert + #pragma fragment frag + #pragma target 3.0 + + #include "UnityCG.cginc" + + fixed4 _Color; + half _Thickness; + half _DashFrequency; + + struct vInput + { + float4 vertex : POSITION; + half4 texcoord : TEXCOORD0; + }; + + struct vOutput + { + float4 pos : SV_POSITION; + float2 uv : TEXCOORD0; + }; + + vOutput vert(vInput i) + { + vOutput o; + + o.pos = UnityObjectToClipPos(i.vertex); + + o.uv = i.texcoord.xy; + o.uv.x *= length(float3(unity_ObjectToWorld[0].z, unity_ObjectToWorld[1].z, unity_ObjectToWorld[2].z)); + + return o; + } + + fixed4 frag(vOutput i) : SV_Target + { + half2 mass = half2(sin(i.uv.x * _DashFrequency), i.uv.y); + + half2 width = abs(ddx(mass)) + abs(ddy(mass)); + half2 smoothed = smoothstep(half2(0, 0), width * _Thickness, mass.xy); + half alpha = max(smoothed.x, smoothed.y); + + return fixed4(_Color.x, _Color.y, _Color.z, 1 - alpha); + } + + ENDCG + } //Pass + } //SubShader +} //Shader diff --git a/Assets/ThirdParty/UMotion/UMotionEditor/Shaders/UnlitLine.shader b/Assets/ThirdParty/UMotion/UMotionEditor/Shaders/UnlitLine.shader index 6c789116..29e1927d 100644 --- a/Assets/ThirdParty/UMotion/UMotionEditor/Shaders/UnlitLine.shader +++ b/Assets/ThirdParty/UMotion/UMotionEditor/Shaders/UnlitLine.shader @@ -1,63 +1,63 @@ -Shader "UMotion Editor/Unlit Line" -{ - Properties - { - _Color("Line Color (RGB) Trans (A)", color) = (0, 0, 0, 1) - _Thickness("Line Thikness", Range(0, 4)) = 0.9 - } - - SubShader - { - Tags {"Queue"="Transparent" "RenderType"="Transparent" "IgnoreProjector"="True" } - LOD 100 - - ZWrite Off - Blend SrcAlpha OneMinusSrcAlpha - Cull Off - - Pass - { - CGPROGRAM - #pragma vertex vert - #pragma fragment frag - #pragma target 3.0 - - #include "UnityCG.cginc" - - fixed4 _Color; - half _Thickness; - - struct vInput - { - float4 vertex : POSITION; - half4 texcoord : TEXCOORD0; - }; - - struct vOutput - { - float4 pos : SV_POSITION; - float uv_y : TEXCOORD0; - }; - - vOutput vert(vInput i) - { - vOutput o; - - o.pos = UnityObjectToClipPos(i.vertex); - o.uv_y = i.texcoord.y; - - return o; - } - - fixed4 frag(vOutput i) : SV_Target - { - half width = abs(ddx(i.uv_y)) + abs(ddy(i.uv_y)); - half alpha = smoothstep(0, width * _Thickness, i.uv_y); - - return fixed4(_Color.x, _Color.y, _Color.z, 1 - alpha); - } - - ENDCG - } //Pass - } //SubShader -} //Shader +Shader "UMotion Editor/Unlit Line" +{ + Properties + { + _Color("Line Color (RGB) Trans (A)", color) = (0, 0, 0, 1) + _Thickness("Line Thikness", Range(0, 4)) = 0.9 + } + + SubShader + { + Tags {"Queue"="Transparent" "RenderType"="Transparent" "IgnoreProjector"="True" } + LOD 100 + + ZWrite Off + Blend SrcAlpha OneMinusSrcAlpha + Cull Off + + Pass + { + CGPROGRAM + #pragma vertex vert + #pragma fragment frag + #pragma target 3.0 + + #include "UnityCG.cginc" + + fixed4 _Color; + half _Thickness; + + struct vInput + { + float4 vertex : POSITION; + half4 texcoord : TEXCOORD0; + }; + + struct vOutput + { + float4 pos : SV_POSITION; + float uv_y : TEXCOORD0; + }; + + vOutput vert(vInput i) + { + vOutput o; + + o.pos = UnityObjectToClipPos(i.vertex); + o.uv_y = i.texcoord.y; + + return o; + } + + fixed4 frag(vOutput i) : SV_Target + { + half width = abs(ddx(i.uv_y)) + abs(ddy(i.uv_y)); + half alpha = smoothstep(0, width * _Thickness, i.uv_y); + + return fixed4(_Color.x, _Color.y, _Color.z, 1 - alpha); + } + + ENDCG + } //Pass + } //SubShader +} //Shader diff --git a/Assets/ThirdParty/UMotion/UMotionEditor/Shaders/VertexColorUnlit.shader b/Assets/ThirdParty/UMotion/UMotionEditor/Shaders/VertexColorUnlit.shader index 6be5ffb1..f4535f98 100644 --- a/Assets/ThirdParty/UMotion/UMotionEditor/Shaders/VertexColorUnlit.shader +++ b/Assets/ThirdParty/UMotion/UMotionEditor/Shaders/VertexColorUnlit.shader @@ -1,32 +1,32 @@ -// Source: http://wiki.unity3d.com/index.php/VertexColorUnlit -Shader "UMotion Editor/Vertex Color Unlit" -{ - Properties - { - _MainTex ("Texture", 2D) = "white" {} - } - - Category - { - Tags { "RenderType"="Opaque" "IgnoreProjector"="True" } - Lighting Off - - BindChannels - { - Bind "Color", color - Bind "Vertex", vertex - Bind "TexCoord", texcoord - } - - SubShader - { - Pass - { - SetTexture [_MainTex] - { - Combine texture * primary DOUBLE - } - } - } - } +// Source: http://wiki.unity3d.com/index.php/VertexColorUnlit +Shader "UMotion Editor/Vertex Color Unlit" +{ + Properties + { + _MainTex ("Texture", 2D) = "white" {} + } + + Category + { + Tags { "RenderType"="Opaque" "IgnoreProjector"="True" } + Lighting Off + + BindChannels + { + Bind "Color", color + Bind "Vertex", vertex + Bind "TexCoord", texcoord + } + + SubShader + { + Pass + { + SetTexture [_MainTex] + { + Combine texture * primary DOUBLE + } + } + } + } } \ No newline at end of file diff --git a/Assets/ThirdParty/UMotion/UMotionEditor/Shaders/WiresOnly.shader b/Assets/ThirdParty/UMotion/UMotionEditor/Shaders/WiresOnly.shader index cd0db9b9..2a9c6879 100644 --- a/Assets/ThirdParty/UMotion/UMotionEditor/Shaders/WiresOnly.shader +++ b/Assets/ThirdParty/UMotion/UMotionEditor/Shaders/WiresOnly.shader @@ -1,65 +1,65 @@ -Shader "UMotion Editor/Wires Only" -{ - Properties - { - _Color("Main Color (RGB)", color) = (1, 1, 1, 1) - _Size("Wire Size", Range(0, 4)) = 0.9 - } - - SubShader - { - Tags {"Queue"="Transparent" "RenderType"="Transparent" "IgnoreProjector"="True" } - LOD 100 - - ZWrite Off - Blend SrcAlpha OneMinusSrcAlpha - Cull Off - - Pass - { - CGPROGRAM - #pragma vertex vert - #pragma fragment frag - #pragma target 3.0 - - #include "UnityCG.cginc" - - fixed4 _Color; - half _Size; - - struct vInput - { - float4 vertex : POSITION; - half4 texcoord : TEXCOORD0; - }; - - struct vOutput - { - float4 pos : SV_POSITION; - fixed3 wirecoord : TEXCOORD1; - }; - - vOutput vert(vInput i) - { - vOutput o; - - o.pos = UnityObjectToClipPos(i.vertex); - - o.wirecoord = fixed3(floor(i.texcoord.x), frac(i.texcoord.x) * 10, i.texcoord.y); - - return o; - } - - fixed4 frag(vOutput i) : SV_Target - { - half3 width = abs(ddx(i.wirecoord.xyz)) + abs(ddy(i.wirecoord.xyz)); - half3 smoothed = smoothstep(half3(0, 0, 0), width * _Size, i.wirecoord.xyz); - half wireAlpha = min(min(smoothed.x, smoothed.y), smoothed.z); - - return fixed4(_Color.xyz, 1 - wireAlpha); - } - - ENDCG - } //Pass - } //SubShader -} //Shader +Shader "UMotion Editor/Wires Only" +{ + Properties + { + _Color("Main Color (RGB)", color) = (1, 1, 1, 1) + _Size("Wire Size", Range(0, 4)) = 0.9 + } + + SubShader + { + Tags {"Queue"="Transparent" "RenderType"="Transparent" "IgnoreProjector"="True" } + LOD 100 + + ZWrite Off + Blend SrcAlpha OneMinusSrcAlpha + Cull Off + + Pass + { + CGPROGRAM + #pragma vertex vert + #pragma fragment frag + #pragma target 3.0 + + #include "UnityCG.cginc" + + fixed4 _Color; + half _Size; + + struct vInput + { + float4 vertex : POSITION; + half4 texcoord : TEXCOORD0; + }; + + struct vOutput + { + float4 pos : SV_POSITION; + fixed3 wirecoord : TEXCOORD1; + }; + + vOutput vert(vInput i) + { + vOutput o; + + o.pos = UnityObjectToClipPos(i.vertex); + + o.wirecoord = fixed3(floor(i.texcoord.x), frac(i.texcoord.x) * 10, i.texcoord.y); + + return o; + } + + fixed4 frag(vOutput i) : SV_Target + { + half3 width = abs(ddx(i.wirecoord.xyz)) + abs(ddy(i.wirecoord.xyz)); + half3 smoothed = smoothstep(half3(0, 0, 0), width * _Size, i.wirecoord.xyz); + half wireAlpha = min(min(smoothed.x, smoothed.y), smoothed.z); + + return fixed4(_Color.xyz, 1 - wireAlpha); + } + + ENDCG + } //Pass + } //SubShader +} //Shader -- cgit v1.1-26-g67d0