mirror of
https://github.com/drewcassidy/KSP-Conformal-Decals.git
synced 2024-09-01 18:23:54 +00:00
Shader formatting
This commit is contained in:
parent
4ed4676488
commit
8acf17f189
@ -14,10 +14,10 @@ Shader "ConformalDecals/Decal Back"
|
|||||||
_Shininess ("Shininess", Range (0.03, 10)) = 0.4
|
_Shininess ("Shininess", Range (0.03, 10)) = 0.4
|
||||||
|
|
||||||
[Header(Effects)]
|
[Header(Effects)]
|
||||||
[PerRendererData]_Opacity("_Opacity", Range(0,1) ) = 1
|
[PerRendererData]_Opacity("_Opacity", Range(0,1) ) = 1
|
||||||
[PerRendererData]_RimFalloff("_RimFalloff", Range(0.01,5) ) = 0.1
|
[PerRendererData]_RimFalloff("_RimFalloff", Range(0.01,5) ) = 0.1
|
||||||
[PerRendererData]_RimColor("_RimColor", Color) = (0,0,0,0)
|
[PerRendererData]_RimColor("_RimColor", Color) = (0,0,0,0)
|
||||||
[PerRendererData]_UnderwaterFogFactor ("Underwater Fog Factor", Range(0,1)) = 0
|
[PerRendererData]_UnderwaterFogFactor ("Underwater Fog Factor", Range(0,1)) = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
SubShader
|
SubShader
|
||||||
|
@ -3,22 +3,22 @@ Shader "ConformalDecals/Feature/Bumped"
|
|||||||
Properties
|
Properties
|
||||||
{
|
{
|
||||||
[Header(Texture Maps)]
|
[Header(Texture Maps)]
|
||||||
_Decal("Decal Texture", 2D) = "gray" {}
|
_Decal("Decal Texture", 2D) = "gray" {}
|
||||||
_DecalBumpMap("Decal Bump Map", 2D) = "bump" {}
|
_DecalBumpMap("Decal Bump Map", 2D) = "bump" {}
|
||||||
|
|
||||||
_Cutoff ("Alpha cutoff", Range(0,1)) = 0.5
|
_Cutoff ("Alpha cutoff", Range(0,1)) = 0.5
|
||||||
_DecalOpacity("Opacity", Range(0,1) ) = 1
|
_DecalOpacity("Opacity", Range(0,1) ) = 1
|
||||||
_Background("Background Color", Color) = (0.9,0.9,0.9,0.7)
|
_Background("Background Color", Color) = (0.9,0.9,0.9,0.7)
|
||||||
|
|
||||||
[Enum(UnityEngine.Rendering.CullMode)] _Cull ("Cull", int) = 2
|
[Enum(UnityEngine.Rendering.CullMode)] _Cull ("Cull", int) = 2
|
||||||
[Toggle(DECAL_PREVIEW)] _Preview ("Preview", int) = 0
|
[Toggle(DECAL_PREVIEW)] _Preview ("Preview", int) = 0
|
||||||
|
|
||||||
[Header(Effects)]
|
[Header(Effects)]
|
||||||
[PerRendererData]_Opacity("_Opacity", Range(0,1) ) = 1
|
[PerRendererData]_Opacity("_Opacity", Range(0,1) ) = 1
|
||||||
[PerRendererData]_Color("_Color", Color) = (1,1,1,1)
|
[PerRendererData]_Color("_Color", Color) = (1,1,1,1)
|
||||||
[PerRendererData]_RimFalloff("_RimFalloff", Range(0.01,5) ) = 0.1
|
[PerRendererData]_RimFalloff("_RimFalloff", Range(0.01,5) ) = 0.1
|
||||||
[PerRendererData]_RimColor("_RimColor", Color) = (0,0,0,0)
|
[PerRendererData]_RimColor("_RimColor", Color) = (0,0,0,0)
|
||||||
[PerRendererData]_UnderwaterFogFactor ("Underwater Fog Factor", Range(0,1)) = 0
|
[PerRendererData]_UnderwaterFogFactor ("Underwater Fog Factor", Range(0,1)) = 0
|
||||||
}
|
}
|
||||||
SubShader
|
SubShader
|
||||||
{
|
{
|
||||||
@ -29,8 +29,8 @@ Shader "ConformalDecals/Feature/Bumped"
|
|||||||
Pass
|
Pass
|
||||||
{
|
{
|
||||||
Name "FORWARD"
|
Name "FORWARD"
|
||||||
Tags { "LightMode" = "ForwardBase" }
|
Tags { "LightMode" = "ForwardBase" }
|
||||||
Blend SrcAlpha OneMinusSrcAlpha
|
Blend SrcAlpha OneMinusSrcAlpha
|
||||||
|
|
||||||
CGPROGRAM
|
CGPROGRAM
|
||||||
#pragma vertex vert_forward
|
#pragma vertex vert_forward
|
||||||
@ -78,8 +78,8 @@ Shader "ConformalDecals/Feature/Bumped"
|
|||||||
Pass
|
Pass
|
||||||
{
|
{
|
||||||
Name "FORWARD"
|
Name "FORWARD"
|
||||||
Tags { "LightMode" = "ForwardAdd" }
|
Tags { "LightMode" = "ForwardAdd" }
|
||||||
Blend One One
|
Blend One One
|
||||||
|
|
||||||
CGPROGRAM
|
CGPROGRAM
|
||||||
#pragma vertex vert_forward
|
#pragma vertex vert_forward
|
||||||
|
@ -3,25 +3,25 @@ Shader "ConformalDecals/Paint/Diffuse"
|
|||||||
Properties
|
Properties
|
||||||
{
|
{
|
||||||
[Header(Texture Maps)]
|
[Header(Texture Maps)]
|
||||||
_Decal("Decal Texture", 2D) = "gray" {}
|
_Decal("Decal Texture", 2D) = "gray" {}
|
||||||
_BumpMap("Bump Map", 2D) = "bump" {}
|
_BumpMap("Bump Map", 2D) = "bump" {}
|
||||||
|
|
||||||
_EdgeWearStrength("Edge Wear Strength", Range(0,500)) = 100
|
_EdgeWearStrength("Edge Wear Strength", Range(0,500)) = 100
|
||||||
_EdgeWearOffset("Edge Wear Offset", Range(0,1)) = 0.1
|
_EdgeWearOffset("Edge Wear Offset", Range(0,1)) = 0.1
|
||||||
|
|
||||||
_Cutoff ("Alpha cutoff", Range(0,1)) = 0.5
|
_Cutoff ("Alpha cutoff", Range(0,1)) = 0.5
|
||||||
_DecalOpacity("Opacity", Range(0,1) ) = 1
|
_DecalOpacity("Opacity", Range(0,1) ) = 1
|
||||||
_Background("Background Color", Color) = (0.9,0.9,0.9,0.7)
|
_Background("Background Color", Color) = (0.9,0.9,0.9,0.7)
|
||||||
|
|
||||||
[Enum(UnityEngine.Rendering.CullMode)] _Cull ("Cull", int) = 2
|
[Enum(UnityEngine.Rendering.CullMode)] _Cull ("Cull", int) = 2
|
||||||
[Toggle(DECAL_PREVIEW)] _Preview ("Preview", int) = 0
|
[Toggle(DECAL_PREVIEW)] _Preview ("Preview", int) = 0
|
||||||
|
|
||||||
[Header(Effects)]
|
[Header(Effects)]
|
||||||
[PerRendererData]_Opacity("_Opacity", Range(0,1) ) = 1
|
[PerRendererData]_Opacity("_Opacity", Range(0,1) ) = 1
|
||||||
[PerRendererData]_Color("_Color", Color) = (1,1,1,1)
|
[PerRendererData]_Color("_Color", Color) = (1,1,1,1)
|
||||||
[PerRendererData]_RimFalloff("_RimFalloff", Range(0.01,5) ) = 0.1
|
[PerRendererData]_RimFalloff("_RimFalloff", Range(0.01,5) ) = 0.1
|
||||||
[PerRendererData]_RimColor("_RimColor", Color) = (0,0,0,0)
|
[PerRendererData]_RimColor("_RimColor", Color) = (0,0,0,0)
|
||||||
[PerRendererData]_UnderwaterFogFactor ("Underwater Fog Factor", Range(0,1)) = 0
|
[PerRendererData]_UnderwaterFogFactor ("Underwater Fog Factor", Range(0,1)) = 0
|
||||||
}
|
}
|
||||||
SubShader
|
SubShader
|
||||||
{
|
{
|
||||||
@ -32,8 +32,8 @@ Shader "ConformalDecals/Paint/Diffuse"
|
|||||||
Pass
|
Pass
|
||||||
{
|
{
|
||||||
Name "FORWARD"
|
Name "FORWARD"
|
||||||
Tags { "LightMode" = "ForwardBase" }
|
Tags { "LightMode" = "ForwardBase" }
|
||||||
Blend SrcAlpha OneMinusSrcAlpha
|
Blend SrcAlpha OneMinusSrcAlpha
|
||||||
|
|
||||||
CGPROGRAM
|
CGPROGRAM
|
||||||
#pragma vertex vert_forward
|
#pragma vertex vert_forward
|
||||||
@ -86,8 +86,8 @@ Shader "ConformalDecals/Paint/Diffuse"
|
|||||||
Pass
|
Pass
|
||||||
{
|
{
|
||||||
Name "FORWARD"
|
Name "FORWARD"
|
||||||
Tags { "LightMode" = "ForwardAdd" }
|
Tags { "LightMode" = "ForwardAdd" }
|
||||||
Blend One One
|
Blend One One
|
||||||
|
|
||||||
CGPROGRAM
|
CGPROGRAM
|
||||||
#pragma vertex vert_forward
|
#pragma vertex vert_forward
|
||||||
|
@ -3,27 +3,27 @@ Shader "ConformalDecals/Paint/DiffuseSDF"
|
|||||||
Properties
|
Properties
|
||||||
{
|
{
|
||||||
[Header(Texture Maps)]
|
[Header(Texture Maps)]
|
||||||
_Decal("Decal Texture", 2D) = "gray" {}
|
_Decal("Decal Texture", 2D) = "gray" {}
|
||||||
_BumpMap("Bump Map", 2D) = "bump" {}
|
_BumpMap("Bump Map", 2D) = "bump" {}
|
||||||
|
|
||||||
_EdgeWearStrength("Edge Wear Strength", Range(0,500)) = 100
|
_EdgeWearStrength("Edge Wear Strength", Range(0,500)) = 100
|
||||||
_EdgeWearOffset("Edge Wear Offset", Range(0,1)) = 0.1
|
_EdgeWearOffset("Edge Wear Offset", Range(0,1)) = 0.1
|
||||||
|
|
||||||
_Cutoff ("Alpha cutoff", Range(0,1)) = 0.5
|
_Cutoff ("Alpha cutoff", Range(0,1)) = 0.5
|
||||||
_Smoothness ("SDF smoothness", Range(0,1)) = 0.15
|
_Smoothness ("SDF smoothness", Range(0,1)) = 0.15
|
||||||
_SmoothnessMipScale ("Smoothness fadeout", Range(0,1)) = 0.1
|
_SmoothnessMipScale ("Smoothness fadeout", Range(0,1)) = 0.1
|
||||||
_DecalOpacity("Opacity", Range(0,1) ) = 1
|
_DecalOpacity("Opacity", Range(0,1) ) = 1
|
||||||
_Background("Background Color", Color) = (0.9,0.9,0.9,0.7)
|
_Background("Background Color", Color) = (0.9,0.9,0.9,0.7)
|
||||||
|
|
||||||
[Enum(UnityEngine.Rendering.CullMode)] _Cull ("Cull", int) = 2
|
[Enum(UnityEngine.Rendering.CullMode)] _Cull ("Cull", int) = 2
|
||||||
[Toggle(DECAL_PREVIEW)] _Preview ("Preview", int) = 0
|
[Toggle(DECAL_PREVIEW)] _Preview ("Preview", int) = 0
|
||||||
|
|
||||||
[Header(Effects)]
|
[Header(Effects)]
|
||||||
[PerRendererData]_Opacity("_Opacity", Range(0,1) ) = 1
|
[PerRendererData]_Opacity("_Opacity", Range(0,1) ) = 1
|
||||||
[PerRendererData]_Color("_Color", Color) = (1,1,1,1)
|
[PerRendererData]_Color("_Color", Color) = (1,1,1,1)
|
||||||
[PerRendererData]_RimFalloff("_RimFalloff", Range(0.01,5) ) = 0.1
|
[PerRendererData]_RimFalloff("_RimFalloff", Range(0.01,5) ) = 0.1
|
||||||
[PerRendererData]_RimColor("_RimColor", Color) = (0,0,0,0)
|
[PerRendererData]_RimColor("_RimColor", Color) = (0,0,0,0)
|
||||||
[PerRendererData]_UnderwaterFogFactor ("Underwater Fog Factor", Range(0,1)) = 0
|
[PerRendererData]_UnderwaterFogFactor ("Underwater Fog Factor", Range(0,1)) = 0
|
||||||
}
|
}
|
||||||
SubShader
|
SubShader
|
||||||
{
|
{
|
||||||
@ -34,8 +34,8 @@ Shader "ConformalDecals/Paint/DiffuseSDF"
|
|||||||
Pass
|
Pass
|
||||||
{
|
{
|
||||||
Name "FORWARD"
|
Name "FORWARD"
|
||||||
Tags { "LightMode" = "ForwardBase" }
|
Tags { "LightMode" = "ForwardBase" }
|
||||||
Blend SrcAlpha OneMinusSrcAlpha
|
Blend SrcAlpha OneMinusSrcAlpha
|
||||||
|
|
||||||
CGPROGRAM
|
CGPROGRAM
|
||||||
#pragma vertex vert_forward
|
#pragma vertex vert_forward
|
||||||
@ -95,8 +95,8 @@ Shader "ConformalDecals/Paint/DiffuseSDF"
|
|||||||
Pass
|
Pass
|
||||||
{
|
{
|
||||||
Name "FORWARD"
|
Name "FORWARD"
|
||||||
Tags { "LightMode" = "ForwardAdd" }
|
Tags { "LightMode" = "ForwardAdd" }
|
||||||
Blend One One
|
Blend One One
|
||||||
|
|
||||||
CGPROGRAM
|
CGPROGRAM
|
||||||
#pragma vertex vert_forward
|
#pragma vertex vert_forward
|
||||||
|
@ -3,16 +3,16 @@ Shader "ConformalDecals/Paint/Specular"
|
|||||||
Properties
|
Properties
|
||||||
{
|
{
|
||||||
[Header(Texture Maps)]
|
[Header(Texture Maps)]
|
||||||
_Decal("Decal Texture", 2D) = "gray" {}
|
_Decal("Decal Texture", 2D) = "gray" {}
|
||||||
_BumpMap("Bump Map", 2D) = "bump" {}
|
_BumpMap("Bump Map", 2D) = "bump" {}
|
||||||
_SpecMap("Specular Map", 2D) = "black" {}
|
_SpecMap("Specular Map", 2D) = "black" {}
|
||||||
|
|
||||||
_EdgeWearStrength("Edge Wear Strength", Range(0,500)) = 100
|
_EdgeWearStrength("Edge Wear Strength", Range(0,500)) = 100
|
||||||
_EdgeWearOffset("Edge Wear Offset", Range(0,1)) = 0.1
|
_EdgeWearOffset("Edge Wear Offset", Range(0,1)) = 0.1
|
||||||
|
|
||||||
_Cutoff ("Alpha cutoff", Range(0,1)) = 0.5
|
_Cutoff ("Alpha cutoff", Range(0,1)) = 0.5
|
||||||
_DecalOpacity("Opacity", Range(0,1) ) = 1
|
_DecalOpacity("Opacity", Range(0,1) ) = 1
|
||||||
_Background("Background Color", Color) = (0.9,0.9,0.9,0.7)
|
_Background("Background Color", Color) = (0.9,0.9,0.9,0.7)
|
||||||
|
|
||||||
[Header(Specularity)]
|
[Header(Specularity)]
|
||||||
_SpecColor ("_SpecColor", Color) = (0.25, 0.25, 0.25, 1)
|
_SpecColor ("_SpecColor", Color) = (0.25, 0.25, 0.25, 1)
|
||||||
@ -21,12 +21,12 @@ Shader "ConformalDecals/Paint/Specular"
|
|||||||
[Enum(UnityEngine.Rendering.CullMode)] _Cull ("Cull", int) = 2
|
[Enum(UnityEngine.Rendering.CullMode)] _Cull ("Cull", int) = 2
|
||||||
[Toggle(DECAL_PREVIEW)] _Preview ("Preview", int) = 0
|
[Toggle(DECAL_PREVIEW)] _Preview ("Preview", int) = 0
|
||||||
|
|
||||||
[Header(Effects)]
|
[Header(Effects)]
|
||||||
[PerRendererData]_Opacity("_Opacity", Range(0,1) ) = 1
|
[PerRendererData]_Opacity("_Opacity", Range(0,1) ) = 1
|
||||||
[PerRendererData]_Color("_Color", Color) = (1,1,1,1)
|
[PerRendererData]_Color("_Color", Color) = (1,1,1,1)
|
||||||
[PerRendererData]_RimFalloff("_RimFalloff", Range(0.01,5) ) = 0.1
|
[PerRendererData]_RimFalloff("_RimFalloff", Range(0.01,5) ) = 0.1
|
||||||
[PerRendererData]_RimColor("_RimColor", Color) = (0,0,0,0)
|
[PerRendererData]_RimColor("_RimColor", Color) = (0,0,0,0)
|
||||||
[PerRendererData]_UnderwaterFogFactor ("Underwater Fog Factor", Range(0,1)) = 0
|
[PerRendererData]_UnderwaterFogFactor ("Underwater Fog Factor", Range(0,1)) = 0
|
||||||
}
|
}
|
||||||
SubShader
|
SubShader
|
||||||
{
|
{
|
||||||
@ -37,8 +37,8 @@ Shader "ConformalDecals/Paint/Specular"
|
|||||||
Pass
|
Pass
|
||||||
{
|
{
|
||||||
Name "FORWARD"
|
Name "FORWARD"
|
||||||
Tags { "LightMode" = "ForwardBase" }
|
Tags { "LightMode" = "ForwardBase" }
|
||||||
Blend SrcAlpha OneMinusSrcAlpha
|
Blend SrcAlpha OneMinusSrcAlpha
|
||||||
|
|
||||||
CGPROGRAM
|
CGPROGRAM
|
||||||
#pragma vertex vert_forward
|
#pragma vertex vert_forward
|
||||||
@ -100,8 +100,8 @@ Shader "ConformalDecals/Paint/Specular"
|
|||||||
Pass
|
Pass
|
||||||
{
|
{
|
||||||
Name "FORWARD"
|
Name "FORWARD"
|
||||||
Tags { "LightMode" = "ForwardAdd" }
|
Tags { "LightMode" = "ForwardAdd" }
|
||||||
Blend One One
|
Blend One One
|
||||||
|
|
||||||
CGPROGRAM
|
CGPROGRAM
|
||||||
#pragma vertex vert_forward
|
#pragma vertex vert_forward
|
||||||
|
@ -3,18 +3,18 @@ Shader "ConformalDecals/Paint/SpecularSDF"
|
|||||||
Properties
|
Properties
|
||||||
{
|
{
|
||||||
[Header(Texture Maps)]
|
[Header(Texture Maps)]
|
||||||
_Decal("Decal Texture", 2D) = "gray" {}
|
_Decal("Decal Texture", 2D) = "gray" {}
|
||||||
_BumpMap("Bump Map", 2D) = "bump" {}
|
_BumpMap("Bump Map", 2D) = "bump" {}
|
||||||
_SpecMap("Specular Map", 2D) = "black" {}
|
_SpecMap("Specular Map", 2D) = "black" {}
|
||||||
|
|
||||||
_EdgeWearStrength("Edge Wear Strength", Range(0,500)) = 100
|
_EdgeWearStrength("Edge Wear Strength", Range(0,500)) = 100
|
||||||
_EdgeWearOffset("Edge Wear Offset", Range(0,1)) = 0.1
|
_EdgeWearOffset("Edge Wear Offset", Range(0,1)) = 0.1
|
||||||
|
|
||||||
_Cutoff ("Alpha cutoff", Range(0,1)) = 0.5
|
_Cutoff ("Alpha cutoff", Range(0,1)) = 0.5
|
||||||
_Smoothness ("SDF smoothness", Range(0,1)) = 0.15
|
_Smoothness ("SDF smoothness", Range(0,1)) = 0.15
|
||||||
_SmoothnessMipScale ("Smoothness fadeout", Range(0,1)) = 0.1
|
_SmoothnessMipScale ("Smoothness fadeout", Range(0,1)) = 0.1
|
||||||
_DecalOpacity("Opacity", Range(0,1) ) = 1
|
_DecalOpacity("Opacity", Range(0,1) ) = 1
|
||||||
_Background("Background Color", Color) = (0.9,0.9,0.9,0.7)
|
_Background("Background Color", Color) = (0.9,0.9,0.9,0.7)
|
||||||
|
|
||||||
[Header(Specularity)]
|
[Header(Specularity)]
|
||||||
_SpecColor ("_SpecColor", Color) = (0.25, 0.25, 0.25, 1)
|
_SpecColor ("_SpecColor", Color) = (0.25, 0.25, 0.25, 1)
|
||||||
@ -23,12 +23,12 @@ Shader "ConformalDecals/Paint/SpecularSDF"
|
|||||||
[Enum(UnityEngine.Rendering.CullMode)] _Cull ("Cull", int) = 2
|
[Enum(UnityEngine.Rendering.CullMode)] _Cull ("Cull", int) = 2
|
||||||
[Toggle(DECAL_PREVIEW)] _Preview ("Preview", int) = 0
|
[Toggle(DECAL_PREVIEW)] _Preview ("Preview", int) = 0
|
||||||
|
|
||||||
[Header(Effects)]
|
[Header(Effects)]
|
||||||
[PerRendererData]_Opacity("_Opacity", Range(0,1) ) = 1
|
[PerRendererData]_Opacity("_Opacity", Range(0,1) ) = 1
|
||||||
[PerRendererData]_Color("_Color", Color) = (1,1,1,1)
|
[PerRendererData]_Color("_Color", Color) = (1,1,1,1)
|
||||||
[PerRendererData]_RimFalloff("_RimFalloff", Range(0.01,5) ) = 0.1
|
[PerRendererData]_RimFalloff("_RimFalloff", Range(0.01,5) ) = 0.1
|
||||||
[PerRendererData]_RimColor("_RimColor", Color) = (0,0,0,0)
|
[PerRendererData]_RimColor("_RimColor", Color) = (0,0,0,0)
|
||||||
[PerRendererData]_UnderwaterFogFactor ("Underwater Fog Factor", Range(0,1)) = 0
|
[PerRendererData]_UnderwaterFogFactor ("Underwater Fog Factor", Range(0,1)) = 0
|
||||||
}
|
}
|
||||||
SubShader
|
SubShader
|
||||||
{
|
{
|
||||||
@ -39,8 +39,8 @@ Shader "ConformalDecals/Paint/SpecularSDF"
|
|||||||
Pass
|
Pass
|
||||||
{
|
{
|
||||||
Name "FORWARD"
|
Name "FORWARD"
|
||||||
Tags { "LightMode" = "ForwardBase" }
|
Tags { "LightMode" = "ForwardBase" }
|
||||||
Blend SrcAlpha OneMinusSrcAlpha
|
Blend SrcAlpha OneMinusSrcAlpha
|
||||||
|
|
||||||
CGPROGRAM
|
CGPROGRAM
|
||||||
#pragma vertex vert_forward
|
#pragma vertex vert_forward
|
||||||
@ -108,8 +108,8 @@ Shader "ConformalDecals/Paint/SpecularSDF"
|
|||||||
Pass
|
Pass
|
||||||
{
|
{
|
||||||
Name "FORWARD"
|
Name "FORWARD"
|
||||||
Tags { "LightMode" = "ForwardAdd" }
|
Tags { "LightMode" = "ForwardAdd" }
|
||||||
Blend One One
|
Blend One One
|
||||||
|
|
||||||
CGPROGRAM
|
CGPROGRAM
|
||||||
#pragma vertex vert_forward
|
#pragma vertex vert_forward
|
||||||
|
@ -91,17 +91,17 @@ inline float CalcMipLevel(float2 texture_coord) {
|
|||||||
// modifed version of the KSP BlinnPhong because it does some weird things
|
// modifed version of the KSP BlinnPhong because it does some weird things
|
||||||
inline fixed4 LightingBlinnPhongDecal(SurfaceOutput s, fixed3 lightDir, half3 viewDir, fixed atten)
|
inline fixed4 LightingBlinnPhongDecal(SurfaceOutput s, fixed3 lightDir, half3 viewDir, fixed atten)
|
||||||
{
|
{
|
||||||
s.Normal = normalize(s.Normal);
|
s.Normal = normalize(s.Normal);
|
||||||
half3 h = normalize(lightDir + viewDir);
|
half3 h = normalize(lightDir + viewDir);
|
||||||
|
|
||||||
fixed diff = max(0, dot(s.Normal, lightDir));
|
fixed diff = max(0, dot(s.Normal, lightDir));
|
||||||
|
|
||||||
float nh = max(0, dot(s.Normal, h));
|
float nh = max(0, dot(s.Normal, h));
|
||||||
float spec = pow(nh, s.Specular*128.0) * s.Gloss;
|
float spec = pow(nh, s.Specular*128.0) * s.Gloss;
|
||||||
|
|
||||||
fixed4 c = 0;
|
fixed4 c = 0;
|
||||||
c.rgb = (s.Albedo * _LightColor0.rgb * diff + _LightColor0.rgb * _SpecColor.rgb * spec) * (atten);
|
c.rgb = (s.Albedo * _LightColor0.rgb * diff + _LightColor0.rgb * _SpecColor.rgb * spec) * (atten);
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
// declare surf function,
|
// declare surf function,
|
||||||
|
@ -3,18 +3,18 @@
|
|||||||
|
|
||||||
inline fixed4 LightingBlinnPhongSmooth(SurfaceOutput s, fixed3 lightDir, half3 viewDir, fixed atten)
|
inline fixed4 LightingBlinnPhongSmooth(SurfaceOutput s, fixed3 lightDir, half3 viewDir, fixed atten)
|
||||||
{
|
{
|
||||||
s.Normal = normalize(s.Normal);
|
s.Normal = normalize(s.Normal);
|
||||||
half3 h = normalize(lightDir + viewDir);
|
half3 h = normalize(lightDir + viewDir);
|
||||||
|
|
||||||
fixed diff = max(0, dot(s.Normal, lightDir));
|
fixed diff = max(0, dot(s.Normal, lightDir));
|
||||||
|
|
||||||
float nh = max(0, dot(s.Normal, h));
|
float nh = max(0, dot(s.Normal, h));
|
||||||
float spec = pow(nh, s.Specular*128.0) * s.Gloss;
|
float spec = pow(nh, s.Specular*128.0) * s.Gloss;
|
||||||
|
|
||||||
fixed4 c;
|
fixed4 c;
|
||||||
c.rgb = (s.Albedo * _LightColor0.rgb * diff + _LightColor0.rgb * _SpecColor.rgb * spec) * (atten);
|
c.rgb = (s.Albedo * _LightColor0.rgb * diff + _LightColor0.rgb * _SpecColor.rgb * spec) * (atten);
|
||||||
c.a = s.Alpha + _LightColor0.a * _SpecColor.a * spec * atten;
|
c.a = s.Alpha + _LightColor0.a * _SpecColor.a * spec * atten;
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -22,12 +22,12 @@ inline fixed4 LightingBlinnPhongSmooth(SurfaceOutput s, fixed3 lightDir, half3 v
|
|||||||
|
|
||||||
inline half4 LightingUnlit(SurfaceOutput s, half3 lightDir, half atten)
|
inline half4 LightingUnlit(SurfaceOutput s, half3 lightDir, half atten)
|
||||||
{
|
{
|
||||||
// half diff = max (0, dot (s.Normal, lightDir));
|
// half diff = max (0, dot (s.Normal, lightDir));
|
||||||
|
|
||||||
half4 c;
|
half4 c;
|
||||||
c.rgb = s.Albedo;
|
c.rgb = s.Albedo;
|
||||||
c.a = s.Alpha;
|
c.a = s.Alpha;
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -35,10 +35,10 @@ inline half4 LightingUnlit(SurfaceOutput s, half3 lightDir, half atten)
|
|||||||
|
|
||||||
inline half4 LightingUnlit_PrePass(SurfaceOutput s, half4 light)
|
inline half4 LightingUnlit_PrePass(SurfaceOutput s, half4 light)
|
||||||
{
|
{
|
||||||
half4 c;
|
half4 c;
|
||||||
c.rgb = s.Albedo;
|
c.rgb = s.Albedo;
|
||||||
c.a = s.Alpha;
|
c.a = s.Alpha;
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -53,21 +53,21 @@ fixed4 LightingNoLighting(SurfaceOutput s, fixed3 lightDir, fixed atten) { retur
|
|||||||
float4 _Color;
|
float4 _Color;
|
||||||
half _LightBoost;
|
half _LightBoost;
|
||||||
half4 LightingLightWrapped(SurfaceOutput s, half3 lightDir, half3 viewDir, half atten) {
|
half4 LightingLightWrapped(SurfaceOutput s, half3 lightDir, half3 viewDir, half atten) {
|
||||||
float3 w = _Color.rgb*0.5;
|
float3 w = _Color.rgb*0.5;
|
||||||
half3 NdotL = dot(s.Normal, lightDir);
|
half3 NdotL = dot(s.Normal, lightDir);
|
||||||
|
|
||||||
//Specular term
|
//Specular term
|
||||||
half3 h = normalize(lightDir + viewDir);
|
half3 h = normalize(lightDir + viewDir);
|
||||||
s.Normal = normalize(s.Normal);
|
s.Normal = normalize(s.Normal);
|
||||||
float NdotH = dot(s.Normal, h);
|
float NdotH = dot(s.Normal, h);
|
||||||
float spec = pow(max(NdotH, 0), s.Specular * 128.0) * s.Gloss;
|
float spec = pow(max(NdotH, 0), s.Specular * 128.0) * s.Gloss;
|
||||||
fixed3 specColor = _SpecColor.rgb * _LightColor0.rgb;
|
fixed3 specColor = _SpecColor.rgb * _LightColor0.rgb;
|
||||||
|
|
||||||
half3 diff = NdotL * (1 - w) + w;
|
half3 diff = NdotL * (1 - w) + w;
|
||||||
half4 c;
|
half4 c;
|
||||||
c.rgb = ((s.Albedo * _LightColor0.rgb * diff) + (specColor * spec)) * (atten * _LightBoost);
|
c.rgb = ((s.Albedo * _LightColor0.rgb * diff) + (specColor * spec)) * (atten * _LightBoost);
|
||||||
c.a = s.Alpha + (_LightColor0.a * _SpecColor.a * spec * atten);
|
c.a = s.Alpha + (_LightColor0.a * _SpecColor.a * spec * atten);
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -84,19 +84,19 @@ float _UnderwaterFogFactor;
|
|||||||
|
|
||||||
float4 UnderwaterFog(float3 worldPos, float3 color)
|
float4 UnderwaterFog(float3 worldPos, float3 color)
|
||||||
{
|
{
|
||||||
float3 toPixel = worldPos - _LocalCameraPos.xyz;
|
float3 toPixel = worldPos - _LocalCameraPos.xyz;
|
||||||
float toPixelLength = length(toPixel); ///< Comment out the math--looks better without it.
|
float toPixelLength = length(toPixel); ///< Comment out the math--looks better without it.
|
||||||
//float angleDot = dot(_LocalCameraDir.xyz, toPixel / toPixelLength);
|
//float angleDot = dot(_LocalCameraDir.xyz, toPixel / toPixelLength);
|
||||||
//angleDot = lerp(0.00000001, angleDot, saturate(sign(angleDot)));
|
//angleDot = lerp(0.00000001, angleDot, saturate(sign(angleDot)));
|
||||||
//float waterDist = -_LocalCameraPos.w / angleDot;
|
//float waterDist = -_LocalCameraPos.w / angleDot;
|
||||||
//float dist = min(toPixelLength, waterDist);
|
//float dist = min(toPixelLength, waterDist);
|
||||||
|
|
||||||
|
|
||||||
float underwaterDetection = _UnderwaterFogFactor * _LocalCameraDir.w; ///< sign(1 - sign(_LocalCameraPos.w));
|
float underwaterDetection = _UnderwaterFogFactor * _LocalCameraDir.w; ///< sign(1 - sign(_LocalCameraPos.w));
|
||||||
float albedoLerpValue = underwaterDetection * (_UnderwaterMaxAlbedoFog * saturate(toPixelLength * _UnderwaterAlbedoDistanceScalar));
|
float albedoLerpValue = underwaterDetection * (_UnderwaterMaxAlbedoFog * saturate(toPixelLength * _UnderwaterAlbedoDistanceScalar));
|
||||||
float alphaFactor = 1 - underwaterDetection * (_UnderwaterMaxAlphaFog * saturate((toPixelLength - _UnderwaterMinAlphaFogDistance) * _UnderwaterAlphaDistanceScalar));
|
float alphaFactor = 1 - underwaterDetection * (_UnderwaterMaxAlphaFog * saturate((toPixelLength - _UnderwaterMinAlphaFogDistance) * _UnderwaterAlphaDistanceScalar));
|
||||||
|
|
||||||
return float4(lerp(color, _UnderwaterFogColor.rgb, albedoLerpValue), alphaFactor);
|
return float4(lerp(color, _UnderwaterFogColor.rgb, albedoLerpValue), alphaFactor);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
@ -2,13 +2,13 @@ Shader "ConformalDecals/SelectionGlow"
|
|||||||
{
|
{
|
||||||
Properties
|
Properties
|
||||||
{
|
{
|
||||||
[Header(Effects)]
|
[Header(Effects)]
|
||||||
_RimEdgeGlow("Rim Edge Glow", Range(0, 1)) = 0.45
|
_RimEdgeGlow("Rim Edge Glow", Range(0, 1)) = 0.45
|
||||||
_RimEdgePow("Rim Edge Falloff", Range(0,5)) = 5
|
_RimEdgePow("Rim Edge Falloff", Range(0,5)) = 5
|
||||||
_RimEdgeOpacity("Rim Edge Opacity", Range(0,1)) = 0.2
|
_RimEdgeOpacity("Rim Edge Opacity", Range(0,1)) = 0.2
|
||||||
_RimFalloff("Rim Falloff", Range(0.01,5) ) = 0.1
|
_RimFalloff("Rim Falloff", Range(0.01,5) ) = 0.1
|
||||||
_RimColor("Rim Color", Color) = (0,0,0,0)
|
_RimColor("Rim Color", Color) = (0,0,0,0)
|
||||||
_RimOpacity("Rim Opacity", Range(0,1)) = 0.5
|
_RimOpacity("Rim Opacity", Range(0,1)) = 0.5
|
||||||
}
|
}
|
||||||
SubShader
|
SubShader
|
||||||
{
|
{
|
||||||
@ -17,7 +17,7 @@ Shader "ConformalDecals/SelectionGlow"
|
|||||||
|
|
||||||
Pass
|
Pass
|
||||||
{
|
{
|
||||||
Blend One One
|
Blend One One
|
||||||
|
|
||||||
CGPROGRAM
|
CGPROGRAM
|
||||||
#pragma vertex vert
|
#pragma vertex vert
|
||||||
|
Loading…
Reference in New Issue
Block a user