备份CatanBuilding瘦身独立工程
This commit is contained in:
81
Assets/Scripts/EventWashing/Shaders/OutlineFill.shader
Normal file
81
Assets/Scripts/EventWashing/Shaders/OutlineFill.shader
Normal file
@@ -0,0 +1,81 @@
|
||||
//
|
||||
// OutlineFill.shader
|
||||
// QuickOutline
|
||||
//
|
||||
// Created by Chris Nolet on 2/21/18.
|
||||
// Copyright © 2018 Chris Nolet. All rights reserved.
|
||||
//
|
||||
|
||||
Shader "Bamboo/Outline Fill" {
|
||||
Properties {
|
||||
[Enum(UnityEngine.Rendering.CompareFunction)] _ZTest("ZTest", Float) = 0
|
||||
|
||||
_OutlineColor("Outline Color", Color) = (1, 1, 1, 1)
|
||||
_OutlineWidth("Outline Width", Range(0, 10)) = 2
|
||||
}
|
||||
|
||||
SubShader {
|
||||
Tags {
|
||||
"Queue" = "Transparent+110"
|
||||
"RenderType" = "Transparent"
|
||||
"DisableBatching" = "True"
|
||||
}
|
||||
|
||||
Pass {
|
||||
Name "Fill"
|
||||
Cull Off
|
||||
ZTest [_ZTest]
|
||||
ZWrite Off
|
||||
Blend SrcAlpha OneMinusSrcAlpha
|
||||
ColorMask RGB
|
||||
|
||||
Stencil {
|
||||
Ref 1
|
||||
Comp NotEqual
|
||||
}
|
||||
|
||||
CGPROGRAM
|
||||
#include "UnityCG.cginc"
|
||||
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
|
||||
struct appdata {
|
||||
float4 vertex : POSITION;
|
||||
float3 normal : NORMAL;
|
||||
float3 smoothNormal : TEXCOORD3;
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
};
|
||||
|
||||
struct v2f {
|
||||
float4 position : SV_POSITION;
|
||||
fixed4 color : COLOR;
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
};
|
||||
|
||||
uniform fixed4 _OutlineColor;
|
||||
uniform float _OutlineWidth;
|
||||
|
||||
v2f vert(appdata input) {
|
||||
v2f output;
|
||||
|
||||
UNITY_SETUP_INSTANCE_ID(input);
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output);
|
||||
|
||||
float3 normal = any(input.smoothNormal) ? input.smoothNormal : input.normal;
|
||||
float3 viewPosition = UnityObjectToViewPos(input.vertex);
|
||||
float3 viewNormal = normalize(mul((float3x3)UNITY_MATRIX_IT_MV, normal));
|
||||
|
||||
output.position = UnityViewToClipPos(viewPosition + viewNormal * -viewPosition.z * _OutlineWidth / 1000.0);
|
||||
output.color = _OutlineColor;
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
fixed4 frag(v2f input) : SV_Target {
|
||||
return input.color;
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e83e6b9b79a08e442ade24860c28cd0f
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
33
Assets/Scripts/EventWashing/Shaders/OutlineMask.shader
Normal file
33
Assets/Scripts/EventWashing/Shaders/OutlineMask.shader
Normal file
@@ -0,0 +1,33 @@
|
||||
//
|
||||
// OutlineMask.shader
|
||||
// QuickOutline
|
||||
//
|
||||
// Created by Chris Nolet on 2/21/18.
|
||||
// Copyright © 2018 Chris Nolet. All rights reserved.
|
||||
//
|
||||
|
||||
Shader "Bamboo/Outline Mask" {
|
||||
Properties {
|
||||
[Enum(UnityEngine.Rendering.CompareFunction)] _ZTest("ZTest", Float) = 0
|
||||
}
|
||||
|
||||
SubShader {
|
||||
Tags {
|
||||
"Queue" = "Transparent+100"
|
||||
"RenderType" = "Transparent"
|
||||
}
|
||||
|
||||
Pass {
|
||||
Name "Mask"
|
||||
Cull Off
|
||||
ZTest [_ZTest]
|
||||
ZWrite Off
|
||||
ColorMask 0
|
||||
|
||||
Stencil {
|
||||
Ref 1
|
||||
Pass Replace
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9654e637a0e8c2947b4cc556d0e64c6f
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
71
Assets/Scripts/EventWashing/Shaders/RimLight.shader
Normal file
71
Assets/Scripts/EventWashing/Shaders/RimLight.shader
Normal file
@@ -0,0 +1,71 @@
|
||||
Shader "Bamboo/RimLight"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
_MainTex ("Texture", 2D) = "white" {}
|
||||
_RimColor ("Rim Color", color) = (1.0, 0, 0, 1.0)
|
||||
_RimPower ("Rim Power", Range(0.0001, 3.0)) = 1.0
|
||||
_RimIntensity ("Rim Intensity", Range(0, 100.0)) = 1.0
|
||||
}
|
||||
SubShader
|
||||
{
|
||||
Tags { "RenderType"="Opaque" }
|
||||
LOD 100
|
||||
|
||||
Pass
|
||||
{
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
#include "Lighting.cginc"
|
||||
|
||||
struct appdata
|
||||
{
|
||||
float4 vertex : POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
float3 normal : NORMAL;
|
||||
};
|
||||
|
||||
struct v2f
|
||||
{
|
||||
float2 uv : TEXCOORD0;
|
||||
float4 vertex : SV_POSITION;
|
||||
float3 worldNormal : TEXCOORD1;
|
||||
float3 worldViewDir : TEXCOORD2;
|
||||
};
|
||||
|
||||
sampler2D _MainTex;
|
||||
float4 _MainTex_ST;
|
||||
fixed4 _RimColor;
|
||||
half _RimPower;
|
||||
float _RimIntensity;
|
||||
|
||||
v2f vert (appdata v)
|
||||
{
|
||||
v2f o;
|
||||
o.vertex = UnityObjectToClipPos(v.vertex);
|
||||
o.uv = TRANSFORM_TEX(v.uv, _MainTex);
|
||||
o.worldNormal = UnityObjectToWorldNormal(v.normal);
|
||||
o.worldViewDir = WorldSpaceViewDir(v.vertex);
|
||||
return o;
|
||||
}
|
||||
|
||||
fixed4 frag (v2f i) : SV_Target
|
||||
{
|
||||
fixed3 worldNormal = normalize(i.worldNormal);
|
||||
fixed3 worldViewDir = normalize(i.worldViewDir);
|
||||
|
||||
fixed4 diffuse = tex2D(_MainTex, i.uv);
|
||||
// powÆðË¥¼õ×÷ÓÃ
|
||||
fixed4 rimLight = _RimColor * pow(saturate(1.0 - dot(worldNormal, worldViewDir)), 1.0 / _RimPower) * _RimIntensity;
|
||||
//fixed4 rimLight = _RimColor * saturate(1.0 - dot(worldNormal, worldViewDir)) * _RimIntensity;
|
||||
|
||||
fixed3 color = diffuse.rgb + rimLight;
|
||||
return fixed4(color, 1.0);
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
}
|
||||
9
Assets/Scripts/EventWashing/Shaders/RimLight.shader.meta
Normal file
9
Assets/Scripts/EventWashing/Shaders/RimLight.shader.meta
Normal file
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1fb5272ce26d5b2448fedc0c49861d1e
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user