文件结构优化
This commit is contained in:
1 parent
2be87291b7
commit
1614c6a29b
99 files changed
+1217
-3
No files matched your search
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0b614899667a4fc42a8092264d34597e
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,102 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!21 &2100000
|
||||
Material:
|
||||
serializedVersion: 8
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: PixelMaterial
|
||||
m_Shader: {fileID: 4800000, guid: 128c5f1edaefa4c4fb3f9f7a4615edb2, type: 3}
|
||||
m_Parent: {fileID: 0}
|
||||
m_ModifiedSerializedProperties: 0
|
||||
m_ValidKeywords: []
|
||||
m_InvalidKeywords:
|
||||
- _SEGMENTED_ON
|
||||
m_LightmapFlags: 4
|
||||
m_EnableInstancingVariants: 0
|
||||
m_DoubleSidedGI: 0
|
||||
m_CustomRenderQueue: -1
|
||||
stringTagMap: {}
|
||||
disabledShaderPasses: []
|
||||
m_LockedProperties:
|
||||
m_SavedProperties:
|
||||
serializedVersion: 3
|
||||
m_TexEnvs:
|
||||
- _BumpMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailAlbedoMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailMask:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailNormalMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _EmissionMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _MainTex:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _MetallicGlossMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _OcclusionMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _ParallaxMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
m_Ints: []
|
||||
m_Floats:
|
||||
- _AmbientCol: 0.033
|
||||
- _BumpScale: 1
|
||||
- _Clipped: 0
|
||||
- _ColBright: 0
|
||||
- _ColIntense: 1
|
||||
- _Cutoff: 0.5
|
||||
- _DetailNormalMapScale: 1
|
||||
- _DstBlend: 0
|
||||
- _GlossMapScale: 1
|
||||
- _Glossiness: 0.5
|
||||
- _GlossyReflections: 1
|
||||
- _Lumin: 0.082
|
||||
- _MaxLight: 1
|
||||
- _Metallic: 0
|
||||
- _MinLight: 0.278
|
||||
- _Mode: 0
|
||||
- _OcclusionStrength: 1
|
||||
- _Offset: -0.295
|
||||
- _OtlWidth: 0.09
|
||||
- _Parallax: 0.02
|
||||
- _Segmented: 1
|
||||
- _ShnIntense: 0
|
||||
- _ShnOverlap: 0
|
||||
- _ShnRange: 0.181
|
||||
- _ShnSmooth: 0.009
|
||||
- _SmoothnessTextureChannel: 0
|
||||
- _SpecularHighlights: 1
|
||||
- _SrcBlend: 1
|
||||
- _Steps: 4.21
|
||||
- _StpSmooth: 0.052
|
||||
- _UVSec: 0
|
||||
- _ZWrite: 1
|
||||
m_Colors:
|
||||
- _Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
|
||||
- _OtlColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
|
||||
- _ShnColor: {r: 1, g: 1, b: 0, a: 1}
|
||||
m_BuildTextureStacks: []
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 850d5eab8c52afd4185452ca282c530b
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 2100000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e03af30da286a944c80a3efa49fa6c3f
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c2fb43e12c5fc4841969a8852b77b505
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,42 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 8e6292b2c06870d4495f009f912b9600, type: 3}
|
||||
m_Name: Post-Prosscing Profile
|
||||
m_EditorClassIdentifier:
|
||||
settings:
|
||||
- {fileID: 4568900071650214407}
|
||||
--- !u!114 &4568900071650214407
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 3
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 6050e2d5de785ce4d931e4dbdbf2d755, type: 3}
|
||||
m_Name: ChromaticAberration
|
||||
m_EditorClassIdentifier:
|
||||
active: 1
|
||||
enabled:
|
||||
overrideState: 1
|
||||
value: 1
|
||||
spectralLut:
|
||||
overrideState: 1
|
||||
value: {fileID: 0}
|
||||
defaultState: 1
|
||||
intensity:
|
||||
overrideState: 1
|
||||
value: 1
|
||||
fastMode:
|
||||
overrideState: 1
|
||||
value: 1
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6e8d6d105a8a2194c8c10888712f88ae
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 875459e6967ddcd4a8666810677a3a60
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,40 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!84 &8400000
|
||||
RenderTexture:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: Pixel
|
||||
m_ImageContentsHash:
|
||||
serializedVersion: 2
|
||||
Hash: 00000000000000000000000000000000
|
||||
m_ForcedFallbackFormat: 4
|
||||
m_DownscaleFallback: 0
|
||||
m_IsAlphaChannelOptional: 0
|
||||
serializedVersion: 5
|
||||
m_Width: 120
|
||||
m_Height: 67
|
||||
m_AntiAliasing: 1
|
||||
m_MipCount: -1
|
||||
m_DepthStencilFormat: 94
|
||||
m_ColorFormat: 8
|
||||
m_MipMap: 0
|
||||
m_GenerateMips: 1
|
||||
m_SRGB: 0
|
||||
m_UseDynamicScale: 0
|
||||
m_BindMS: 0
|
||||
m_EnableCompatibleFormat: 1
|
||||
m_EnableRandomWrite: 0
|
||||
m_TextureSettings:
|
||||
serializedVersion: 2
|
||||
m_FilterMode: 0
|
||||
m_Aniso: 0
|
||||
m_MipBias: 0
|
||||
m_WrapU: 1
|
||||
m_WrapV: 1
|
||||
m_WrapW: 1
|
||||
m_Dimension: 2
|
||||
m_VolumeDepth: 1
|
||||
m_ShadowSamplingMode: 2
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 40d6d138feabb2440b709406c89491ac
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 8400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a64d5438c8393204c81a2490a48edc2a
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d6fdf08ede4bb47da9942ca6c29b83a7
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,114 @@
|
||||
#ifndef STCORE_INCLUDED
|
||||
#define STCORE_INCLUDED
|
||||
|
||||
#include "STFunctions.cginc"
|
||||
|
||||
sampler2D _MainTex;
|
||||
float4 _MainTex_ST;
|
||||
|
||||
float4 _Color;
|
||||
float4 _DarkColor;
|
||||
float _AmbientCol;
|
||||
float _ColIntense;
|
||||
float _ColBright;
|
||||
|
||||
bool _Segmented;
|
||||
float _Steps;
|
||||
float _StpSmooth;
|
||||
float _Offset;
|
||||
|
||||
bool _Clipped;
|
||||
float _MinLight;
|
||||
float _MaxLight;
|
||||
float _Lumin;
|
||||
|
||||
float _MaxAtten;
|
||||
|
||||
float4 _ShnColor;
|
||||
bool _ShnOverlap;
|
||||
float _ShnIntense;
|
||||
float _ShnRange;
|
||||
float _ShnSmooth;
|
||||
|
||||
float Toon (float dot, fixed atten)
|
||||
{
|
||||
float offset = clamp(_Offset, -1, 1);
|
||||
float delta = _MaxLight - _MinLight;
|
||||
|
||||
//intense
|
||||
float ints_pls = dot + offset;
|
||||
float ints_max = 1.0 + offset;
|
||||
float intense = clamp01(ints_pls / ints_max);
|
||||
|
||||
//lit
|
||||
float step = 1.0 / floor(_Steps);
|
||||
int lit_num = ceil(intense / step);
|
||||
float lit = lit_num * step;
|
||||
|
||||
//smooth
|
||||
float reduce_v = _Offset - 1.0;
|
||||
float reduce_res = 1.0 - clamp01(reduce_v / 0.1); //!v offset plus
|
||||
float reduce = lit_num == 1 ? reduce_res : 1;
|
||||
|
||||
float smth_start = lit - step;
|
||||
float smth_end = smth_start + step * _StpSmooth;
|
||||
|
||||
float smth_lrp = invLerp01(smth_end, smth_start, intense);
|
||||
float smth_stp = smoothstep(smth_end, smth_start, intense, 0.);
|
||||
|
||||
float smooth_v = smoothlerp(smth_stp, smth_lrp, _StpSmooth);
|
||||
float smooth = clamp01(lit - smooth_v * reduce * step);
|
||||
|
||||
//shadow
|
||||
float atten_inv = clamp(atten, 1.0 - _MaxAtten, 1);
|
||||
float dimLit = smooth * atten_inv;
|
||||
float dim_dlt = dimLit - _MinLight;
|
||||
|
||||
//luminocity
|
||||
float lumLight = _MaxLight + _Lumin;
|
||||
float lum_dlt = lumLight - _MinLight;
|
||||
|
||||
//clipped
|
||||
float litd_clmp = clamp01(dim_dlt);
|
||||
float clip_cf = litd_clmp / delta;
|
||||
|
||||
float clip_uncl = _MinLight + clip_cf * lum_dlt;
|
||||
float clip_v = clamp(clip_uncl, _MinLight, lumLight);
|
||||
|
||||
//relative limits
|
||||
float lerp_v = lum_dlt * dimLit;
|
||||
float relate_v = _MinLight + lerp_v;
|
||||
|
||||
//result
|
||||
float result = _Clipped * clip_v;
|
||||
result += !_Clipped * relate_v;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
//post effects
|
||||
|
||||
void PostShine (inout float4 col, float dot, float atten)
|
||||
{
|
||||
float pos = abs(dot - 1.0);
|
||||
float len = _ShnRange * 2;
|
||||
|
||||
float smth_inv = 1.0 - _ShnSmooth;
|
||||
float smth_end = len * smth_inv;
|
||||
|
||||
float shine = posz(len - pos);
|
||||
float smooth = smoothstep(len, smth_end, pos, 1.);
|
||||
float dim = 1.0 - _MaxAtten * rev(atten) * rev(_ShnOverlap);
|
||||
|
||||
float blend = _ShnIntense * shine * smooth * dim;
|
||||
col = ColorBlend(col, _ShnColor, blend);
|
||||
}
|
||||
|
||||
float4 PostEffects (float4 col, float toon, float atten, float NdotL, float NdotH, float VdotN, float FdotV)
|
||||
{
|
||||
PostShine(col, NdotL, atten);
|
||||
|
||||
return col;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 69d7471035c7c40f695a9199c7916a3e
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,204 @@
|
||||
Shader "Simple Toon/SToon Default"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
_MainTex ("Texture", 2D) = "white" {}
|
||||
|
||||
[Header(Colorize)][Space(5)] //colorize
|
||||
_Color ("Color", COLOR) = (1,1,1,1)
|
||||
|
||||
[HideInInspector] _ColIntense ("Intensity", Range(0,3)) = 1
|
||||
[HideInInspector] _ColBright ("Brightness", Range(-1,1)) = 0
|
||||
_AmbientCol ("Ambient", Range(0,1)) = 0
|
||||
|
||||
[Header(Detail)][Space(5)] //detail
|
||||
[Toggle] _Segmented ("Segmented", Float) = 1
|
||||
_Steps ("Steps", Range(1,25)) = 3
|
||||
_StpSmooth ("Smoothness", Range(0,1)) = 0
|
||||
_Offset ("Lit Offset", Range(-1,1.1)) = 0
|
||||
|
||||
[Header(Light)][Space(5)] //light
|
||||
[Toggle] _Clipped ("Clipped", Float) = 0
|
||||
_MinLight ("Min Light", Range(0,1)) = 0
|
||||
_MaxLight ("Max Light", Range(0,1)) = 1
|
||||
_Lumin ("Luminocity", Range(0,2)) = 0
|
||||
|
||||
[Header(Shine)][Space(5)] //shine
|
||||
[HDR] _ShnColor ("Color", COLOR) = (1,1,0,1)
|
||||
[Toggle] _ShnOverlap ("Overlap", Float) = 0
|
||||
|
||||
_ShnIntense ("Intensity", Range(0,1)) = 0
|
||||
_ShnRange ("Range", Range(0,1)) = 0.15
|
||||
_ShnSmooth ("Smoothness", Range(0,1)) = 0
|
||||
}
|
||||
|
||||
SubShader
|
||||
{
|
||||
Tags { "RenderType" = "Opaque" "LightMode" = "ForwardBase" }
|
||||
Pass
|
||||
{
|
||||
Name "DirectLight"
|
||||
LOD 80
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#pragma multi_compile_fwdbase
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
#include "UnityLightingCommon.cginc"
|
||||
#include "AutoLight.cginc"
|
||||
#include "STCore.cginc"
|
||||
|
||||
struct appdata
|
||||
{
|
||||
float4 vertex : POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
float3 normal : NORMAL;
|
||||
};
|
||||
|
||||
struct v2f
|
||||
{
|
||||
LIGHTING_COORDS(0,1)
|
||||
float2 uv : TEXCOORD0;
|
||||
float4 pos : SV_POSITION;
|
||||
float3 worldNormal : NORMAL;
|
||||
float3 viewDir : TEXCOORD2;
|
||||
};
|
||||
|
||||
v2f vert (appdata v)
|
||||
{
|
||||
v2f o;
|
||||
o.pos = UnityObjectToClipPos(v.vertex);
|
||||
o.uv = TRANSFORM_TEX(v.uv, _MainTex);
|
||||
o.worldNormal = UnityObjectToWorldNormal(v.normal);
|
||||
o.viewDir = WorldSpaceViewDir(v.vertex);
|
||||
|
||||
TRANSFER_VERTEX_TO_FRAGMENT(o);
|
||||
return o;
|
||||
}
|
||||
|
||||
fixed4 frag (v2f i) : SV_Target
|
||||
{
|
||||
_MaxLight = max(_MinLight, _MaxLight);
|
||||
_Steps = _Segmented ? _Steps : 1;
|
||||
_StpSmooth = _Segmented ? _StpSmooth : 1;
|
||||
|
||||
_DarkColor = fixed4(0,0,0,1);
|
||||
_MaxAtten = 1.0;
|
||||
|
||||
float3 normal = normalize(i.worldNormal);
|
||||
float3 light_dir = normalize(_WorldSpaceLightPos0.xyz);
|
||||
float3 view_dir = normalize(i.viewDir);
|
||||
float3 halfVec = normalize(light_dir + view_dir);
|
||||
float3 forward = mul((float3x3)unity_CameraToWorld, float3(0,0,1));
|
||||
|
||||
float NdotL = dot(normal, light_dir);
|
||||
float NdotH = dot(normal, halfVec);
|
||||
float VdotN = dot(view_dir, normal);
|
||||
float FdotV = dot(forward, -view_dir);
|
||||
|
||||
fixed atten = SHADOW_ATTENUATION(i);
|
||||
float toon = Toon(NdotL, atten);
|
||||
|
||||
fixed4 shadecol = _DarkColor;
|
||||
fixed4 litcol = ColorBlend(_Color, _LightColor0, _AmbientCol);
|
||||
fixed4 texcol = tex2D(_MainTex, i.uv) * litcol * _ColIntense + _ColBright;
|
||||
|
||||
float4 blendCol = ColorBlend(shadecol, texcol, toon);
|
||||
float4 postCol = PostEffects(blendCol, toon, atten, NdotL, NdotH, VdotN, FdotV);
|
||||
|
||||
postCol.a = 1.;
|
||||
return _LightColor0.a > 0 ? postCol : 0;
|
||||
}
|
||||
|
||||
ENDCG
|
||||
}
|
||||
|
||||
Tags { "RenderType" = "Opaque" "LightMode" = "ForwardAdd" }
|
||||
Pass
|
||||
{
|
||||
Name "SpotLight"
|
||||
BlendOp Max
|
||||
LOD 100
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#pragma multi_compile_fwdadd_fullshadows
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
#include "UnityLightingCommon.cginc"
|
||||
#include "AutoLight.cginc"
|
||||
#include "STCore.cginc"
|
||||
|
||||
struct appdata
|
||||
{
|
||||
float4 vertex : POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
float3 normal : NORMAL;
|
||||
};
|
||||
|
||||
struct v2f
|
||||
{
|
||||
LIGHTING_COORDS(0,1)
|
||||
float2 uv : TEXCOORDSS;
|
||||
float4 pos : SV_POSITION;
|
||||
float3 worldPos : WORLD;
|
||||
half3 worldNormal : NORMAL;
|
||||
float3 viewDir : TEXCOORD2;
|
||||
};
|
||||
|
||||
v2f vert (appdata v)
|
||||
{
|
||||
v2f o;
|
||||
o.pos = UnityObjectToClipPos(v.vertex);
|
||||
o.uv = TRANSFORM_TEX(v.uv, _MainTex);
|
||||
o.worldNormal = UnityObjectToWorldNormal(v.normal);
|
||||
o.worldPos = mul(unity_ObjectToWorld, v.vertex);
|
||||
o.viewDir = WorldSpaceViewDir(v.vertex);
|
||||
|
||||
TRANSFER_VERTEX_TO_FRAGMENT(o);
|
||||
return o;
|
||||
}
|
||||
|
||||
fixed4 frag (v2f i) : SV_Target
|
||||
{
|
||||
_MaxLight = max(_MinLight, _MaxLight);
|
||||
_Steps = _Segmented ? _Steps : 1;
|
||||
_StpSmooth = _Segmented ? _StpSmooth : 1;
|
||||
|
||||
_DarkColor = fixed4(0,0,0,1);
|
||||
_MaxAtten = 1.0;
|
||||
|
||||
float3 normal = normalize(i.worldNormal);
|
||||
float3 light_dir = normalize(_WorldSpaceLightPos0.xyz - i.worldPos.xyz);
|
||||
float3 view_dir = normalize(i.viewDir);
|
||||
float3 halfVec = normalize(light_dir + view_dir);
|
||||
float3 forward = mul((float3x3)unity_CameraToWorld, float3(0,0,1));
|
||||
|
||||
float NdotL = dot(normal, light_dir);
|
||||
float NdotH = dot(normal, halfVec);
|
||||
float VdotN = dot(view_dir, normal);
|
||||
float FdotV = dot(forward, -view_dir);
|
||||
|
||||
float atten = LIGHT_ATTENUATION(i);
|
||||
float toon = Toon(NdotL, atten);
|
||||
|
||||
fixed4 shadecol = _DarkColor;
|
||||
fixed4 litcol = ColorBlend(_Color, _LightColor0, _AmbientCol);
|
||||
fixed4 texcol = tex2D(_MainTex, i.uv) * litcol * _ColIntense + _ColBright;
|
||||
|
||||
float4 blendCol = ColorBlend(shadecol, texcol, toon);
|
||||
float4 postCol = PostEffects(blendCol, toon, atten, NdotL, NdotH, VdotN, FdotV);
|
||||
|
||||
postCol.a = 1.;
|
||||
return postCol;
|
||||
}
|
||||
|
||||
ENDCG
|
||||
}
|
||||
|
||||
UsePass "Legacy Shaders/VertexLit/SHADOWCASTER"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7cd5de0b884b14f88ab763ef465e1799
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,107 @@
|
||||
#ifndef STFUNCTIONS_INCLUDED
|
||||
#define STFUNCTIONS_INCLUDED
|
||||
|
||||
float clamp01 (float value) {
|
||||
return clamp(value, 0, 1);
|
||||
}
|
||||
|
||||
float rev (float value) {
|
||||
return 1.0 - value;
|
||||
}
|
||||
|
||||
float rev01 (float value) {
|
||||
return clamp01(rev(value));
|
||||
}
|
||||
|
||||
float pos (float value) {
|
||||
return value > 0 ? 1 : 0;
|
||||
}
|
||||
|
||||
float posz (float value) {
|
||||
return value >= 0 ? 1 : 0;
|
||||
}
|
||||
|
||||
float neg (float value) {
|
||||
return value < 0 ? 1 : 0;
|
||||
}
|
||||
|
||||
float negz (float value) {
|
||||
return value <= 0 ? 1 : 0;
|
||||
}
|
||||
|
||||
float lerp01 (float from, float to, float value) {
|
||||
return clamp01(lerp(from, to, value));
|
||||
}
|
||||
|
||||
float invLerp (float from, float to, float value, float equal = 0.) {
|
||||
float val = (value - from) / (to - from);
|
||||
return from == to ? equal : val;
|
||||
}
|
||||
|
||||
float invLerp01 (float from, float to, float value, float equal = 0.) {
|
||||
float val = invLerp(from, to, value, equal);
|
||||
return from == to ? val : clamp01(val);
|
||||
}
|
||||
|
||||
float wght_invLerp (float from, float to, float value, bool invert = false) {
|
||||
float val = (value - from) / (to - from);
|
||||
|
||||
float wgtMin = !invert ? 0 : 1;
|
||||
float wgtMax = !invert ? 1 : 0;
|
||||
float wgt = value < from ? wgtMin : wgtMax;
|
||||
|
||||
float res = value == from ? 0.5 : wgt;
|
||||
return from == to ? res : val;
|
||||
}
|
||||
|
||||
float smoothstep (float from, float to, float value, float equal) {
|
||||
float val = smoothstep(from, to, value);
|
||||
return from == to ? equal : val;
|
||||
}
|
||||
|
||||
float wght_smoothstep (float from, float to, float value, bool invert = false) {
|
||||
float val = smoothstep(from, to, value);
|
||||
|
||||
float wgtMin = !invert ? 0 : 1;
|
||||
float wgtMax = !invert ? 1 : 0;
|
||||
float wgt = value < from ? wgtMin : wgtMax;
|
||||
|
||||
float res = value == from ? 0.5 : wgt;
|
||||
return from == to ? res : val;
|
||||
}
|
||||
|
||||
float smoothlerp (float from, float to, float value) {
|
||||
float val = -(2.0 / ((value + 0.34) * 4.7)) + 1.3;
|
||||
return lerp01(from, to, val);
|
||||
}
|
||||
|
||||
float colmagnmin (float3 color) {
|
||||
float m1 = min(color.r, color.g);
|
||||
return min(m1, color.b);
|
||||
}
|
||||
|
||||
float colmagnmax (float3 color) {
|
||||
float m1 = max(color.r, color.g);
|
||||
return max(m1, color.b);
|
||||
}
|
||||
|
||||
float colspacemax (float3 color) {
|
||||
return rev(colmagnmin(color));
|
||||
}
|
||||
|
||||
float colspacemin (float3 color) {
|
||||
return rev(colmagnmax(color));
|
||||
}
|
||||
|
||||
float4 ColorBlend (float4 tcol, float4 dcol, float blendf)
|
||||
{
|
||||
float4 res = tcol;
|
||||
res.r = lerp(tcol.r, dcol.r, blendf);
|
||||
res.g = lerp(tcol.g, dcol.g, blendf);
|
||||
res.b = lerp(tcol.b, dcol.b, blendf);
|
||||
res.a = lerp(tcol.a, dcol.a, blendf);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fd04a86ca133d4c3e9fbcec891df47ee
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,254 @@
|
||||
Shader "Simple Toon/SToon Outline"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
_MainTex ("Texture", 2D) = "white" {}
|
||||
|
||||
[Header(Colorize)][Space(5)] //colorize
|
||||
_Color ("Color", COLOR) = (1,1,1,1)
|
||||
|
||||
[HideInInspector] _ColIntense ("Intensity", Range(0,3)) = 1
|
||||
[HideInInspector] _ColBright ("Brightness", Range(-1,1)) = 0
|
||||
_AmbientCol ("Ambient", Range(0,1)) = 0
|
||||
|
||||
[Header(Detail)][Space(5)] //detail
|
||||
[Toggle] _Segmented ("Segmented", Float) = 1
|
||||
_Steps ("Steps", Range(1,25)) = 3
|
||||
_StpSmooth ("Smoothness", Range(0,1)) = 0
|
||||
_Offset ("Lit Offset", Range(-1,1.1)) = 0
|
||||
|
||||
[Header(Light)][Space(5)] //light
|
||||
[Toggle] _Clipped ("Clipped", Float) = 0
|
||||
_MinLight ("Min Light", Range(0,1)) = 0
|
||||
_MaxLight ("Max Light", Range(0,1)) = 1
|
||||
_Lumin ("Luminocity", Range(0,2)) = 0
|
||||
|
||||
[Header(Outline)][Space(5)] //outline
|
||||
_OtlColor ("Color", COLOR) = (0,0,0,1)
|
||||
_OtlWidth ("Width", Range(0,5)) = 1
|
||||
|
||||
[Header(Shine)][Space(5)] //shine
|
||||
[HDR] _ShnColor ("Color", COLOR) = (1,1,0,1)
|
||||
[Toggle] _ShnOverlap ("Overlap", Float) = 0
|
||||
|
||||
_ShnIntense ("Intensity", Range(0,1)) = 0
|
||||
_ShnRange ("Range", Range(0,1)) = 0.15
|
||||
_ShnSmooth ("Smoothness", Range(0,1)) = 0
|
||||
}
|
||||
|
||||
SubShader
|
||||
{
|
||||
Tags { "RenderType" = "Opaque" "LightMode" = "ForwardBase" }
|
||||
Pass
|
||||
{
|
||||
Name "DirectLight"
|
||||
LOD 80
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#pragma multi_compile_fwdbase
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
#include "UnityLightingCommon.cginc"
|
||||
#include "AutoLight.cginc"
|
||||
#include "STCore.cginc"
|
||||
|
||||
struct appdata
|
||||
{
|
||||
float4 vertex : POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
float3 normal : NORMAL;
|
||||
};
|
||||
|
||||
struct v2f
|
||||
{
|
||||
LIGHTING_COORDS(0,1)
|
||||
float2 uv : TEXCOORD0;
|
||||
float4 pos : SV_POSITION;
|
||||
half3 worldNormal : NORMAL;
|
||||
float3 viewDir : TEXCOORD2;
|
||||
};
|
||||
|
||||
v2f vert (appdata v)
|
||||
{
|
||||
v2f o;
|
||||
o.pos = UnityObjectToClipPos(v.vertex);
|
||||
o.uv = TRANSFORM_TEX(v.uv, _MainTex);
|
||||
o.worldNormal = UnityObjectToWorldNormal(v.normal);
|
||||
o.viewDir = WorldSpaceViewDir(v.vertex);
|
||||
|
||||
TRANSFER_VERTEX_TO_FRAGMENT(o);
|
||||
return o;
|
||||
}
|
||||
|
||||
fixed4 frag (v2f i) : SV_Target
|
||||
{
|
||||
_MaxLight = max(_MinLight, _MaxLight);
|
||||
_Steps = _Segmented ? _Steps : 1;
|
||||
_StpSmooth = _Segmented ? _StpSmooth : 1;
|
||||
|
||||
_DarkColor = fixed4(0,0,0,1);
|
||||
_MaxAtten = 1.0;
|
||||
|
||||
float3 normal = normalize(i.worldNormal);
|
||||
float3 light_dir = normalize(_WorldSpaceLightPos0.xyz);
|
||||
float3 view_dir = normalize(i.viewDir);
|
||||
float3 halfVec = normalize(light_dir + view_dir);
|
||||
float3 forward = mul((float3x3)unity_CameraToWorld, float3(0,0,1));
|
||||
|
||||
float NdotL = dot(normal, light_dir);
|
||||
float NdotH = dot(normal, halfVec);
|
||||
float VdotN = dot(view_dir, normal);
|
||||
float FdotV = dot(forward, -view_dir);
|
||||
|
||||
fixed atten = SHADOW_ATTENUATION(i);
|
||||
float toon = Toon(NdotL, atten);
|
||||
|
||||
fixed4 shadecol = _DarkColor;
|
||||
fixed4 litcol = ColorBlend(_Color, _LightColor0, _AmbientCol);
|
||||
fixed4 texcol = tex2D(_MainTex, i.uv) * litcol * _ColIntense + _ColBright;
|
||||
|
||||
float4 blendCol = ColorBlend(shadecol, texcol, toon);
|
||||
float4 postCol = PostEffects(blendCol, toon, atten, NdotL, NdotH, VdotN, FdotV);
|
||||
|
||||
postCol.a = 1.;
|
||||
return _LightColor0.a > 0 ? postCol : 0;
|
||||
}
|
||||
|
||||
ENDCG
|
||||
}
|
||||
|
||||
Tags { "RenderType" = "Opaque" "LightMode" = "ForwardAdd" }
|
||||
Pass
|
||||
{
|
||||
Name "SpotLight"
|
||||
BlendOp Max
|
||||
LOD 100
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#pragma multi_compile_fwdadd_fullshadows
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
#include "UnityLightingCommon.cginc"
|
||||
#include "AutoLight.cginc"
|
||||
#include "STCore.cginc"
|
||||
|
||||
struct appdata
|
||||
{
|
||||
float4 vertex : POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
float3 normal : NORMAL;
|
||||
};
|
||||
|
||||
struct v2f
|
||||
{
|
||||
LIGHTING_COORDS(0,1)
|
||||
float2 uv : TEXCOORDSS;
|
||||
float4 pos : SV_POSITION;
|
||||
float3 worldPos : WORLD;
|
||||
half3 worldNormal : NORMAL;
|
||||
float3 viewDir : TEXCOORD2;
|
||||
};
|
||||
|
||||
v2f vert (appdata v)
|
||||
{
|
||||
v2f o;
|
||||
o.pos = UnityObjectToClipPos(v.vertex);
|
||||
o.uv = TRANSFORM_TEX(v.uv, _MainTex);
|
||||
o.worldNormal = UnityObjectToWorldNormal(v.normal);
|
||||
o.worldPos = mul(unity_ObjectToWorld, v.vertex);
|
||||
o.viewDir = WorldSpaceViewDir(v.vertex);
|
||||
|
||||
TRANSFER_VERTEX_TO_FRAGMENT(o);
|
||||
return o;
|
||||
}
|
||||
|
||||
fixed4 frag (v2f i) : SV_Target
|
||||
{
|
||||
_MaxLight = max(_MinLight, _MaxLight);
|
||||
_Steps = _Segmented ? _Steps : 1;
|
||||
_StpSmooth = _Segmented ? _StpSmooth : 1;
|
||||
|
||||
_DarkColor = fixed4(0,0,0,1);
|
||||
_MaxAtten = 1.0;
|
||||
|
||||
float3 normal = normalize(i.worldNormal);
|
||||
float3 light_dir = normalize(_WorldSpaceLightPos0.xyz - i.worldPos.xyz);
|
||||
float3 view_dir = normalize(i.viewDir);
|
||||
float3 halfVec = normalize(light_dir + view_dir);
|
||||
float3 forward = mul((float3x3)unity_CameraToWorld, float3(0,0,1));
|
||||
|
||||
float NdotL = dot(normal, light_dir);
|
||||
float NdotH = dot(normal, halfVec);
|
||||
float VdotN = dot(view_dir, normal);
|
||||
float FdotV = dot(forward, -view_dir);
|
||||
|
||||
float atten = LIGHT_ATTENUATION(i);
|
||||
float toon = Toon(NdotL, atten);
|
||||
|
||||
fixed4 shadecol = _DarkColor;
|
||||
fixed4 litcol = ColorBlend(_Color, _LightColor0, _AmbientCol);
|
||||
fixed4 texcol = tex2D(_MainTex, i.uv) * litcol * _ColIntense + _ColBright;
|
||||
|
||||
float4 blendCol = ColorBlend(shadecol, texcol, toon);
|
||||
float4 postCol = PostEffects(blendCol, toon, atten, NdotL, NdotH, VdotN, FdotV);
|
||||
|
||||
postCol.a = 1.;
|
||||
return postCol;
|
||||
}
|
||||
|
||||
ENDCG
|
||||
}
|
||||
|
||||
UsePass "Legacy Shaders/VertexLit/SHADOWCASTER"
|
||||
|
||||
Pass
|
||||
{
|
||||
Tags { "RenderType" = "Opaque" "LightMode" = "ForwardBase" }
|
||||
Blend Off
|
||||
Cull Front
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
#include "STCore.cginc"
|
||||
|
||||
float4 _OtlColor;
|
||||
float _OtlWidth;
|
||||
|
||||
struct appdata
|
||||
{
|
||||
float4 vertex : POSITION;
|
||||
float3 normal : NORMAL;
|
||||
};
|
||||
|
||||
struct v2f
|
||||
{
|
||||
float4 pos : SV_POSITION;
|
||||
};
|
||||
|
||||
v2f vert (appdata v)
|
||||
{
|
||||
v2f o;
|
||||
o.pos = v.vertex;
|
||||
o.pos.xyz += normalize(v.normal.xyz) * _OtlWidth * 0.008;
|
||||
o.pos = UnityObjectToClipPos(o.pos);
|
||||
|
||||
return o;
|
||||
}
|
||||
|
||||
fixed4 frag(v2f i) : SV_Target
|
||||
{
|
||||
clip(-negz(_OtlWidth));
|
||||
return _OtlColor;
|
||||
}
|
||||
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 128c5f1edaefa4c4fb3f9f7a4615edb2
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,211 @@
|
||||
Shader "Simple Toon/SToon Transparent"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
_MainTex ("Texture", 2D) = "white" {}
|
||||
|
||||
[Header(Colorize)][Space(5)] //colorize
|
||||
_Color ("Color", COLOR) = (1,1,1,1)
|
||||
|
||||
[HideInInspector] _ColIntense ("Intensity", Range(0,3)) = 1
|
||||
[HideInInspector] _ColBright ("Brightness", Range(-1,1)) = 0
|
||||
_AmbientCol ("Ambient", Range(0,1)) = 0
|
||||
|
||||
[Header(Detail)][Space(5)] //detail
|
||||
[Toggle] _Segmented ("Segmented", Float) = 1
|
||||
_Steps ("Steps", Range(1,25)) = 3
|
||||
_StpSmooth ("Smoothness", Range(0,1)) = 0
|
||||
_Offset ("Lit Offset", Range(-1,1.1)) = 0
|
||||
|
||||
[Header(Light)][Space(5)] //light
|
||||
[Toggle] _Clipped ("Clipped", Float) = 0
|
||||
_MinLight ("Min Light", Range(0,1)) = 0
|
||||
_MaxLight ("Max Light", Range(0,1)) = 1
|
||||
_Lumin ("Luminocity", Range(0,2)) = 0
|
||||
|
||||
[Header(Shine)][Space(5)] //shine
|
||||
[HDR] _ShnColor ("Color", COLOR) = (1,1,0,1)
|
||||
[Toggle] _ShnOverlap ("Overlap", Float) = 0
|
||||
|
||||
_ShnIntense ("Intensity", Range(0,1)) = 0
|
||||
_ShnRange ("Range", Range(0,1)) = 0.15
|
||||
_ShnSmooth ("Smoothness", Range(0,1)) = 0
|
||||
}
|
||||
|
||||
SubShader
|
||||
{
|
||||
Tags { "Queue" = "Transparent" "RenderType" = "Transparent" }
|
||||
Blend SrcAlpha OneMinusSrcAlpha
|
||||
|
||||
Pass //full transparency
|
||||
{
|
||||
LOD 300
|
||||
ColorMask 0
|
||||
}
|
||||
|
||||
Pass
|
||||
{
|
||||
Tags { "LightMode" = "ForwardBase" }
|
||||
LOD 80
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#pragma multi_compile_fwdbase
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
#include "UnityLightingCommon.cginc"
|
||||
#include "AutoLight.cginc"
|
||||
#include "STCore.cginc"
|
||||
|
||||
struct appdata
|
||||
{
|
||||
float4 vertex : POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
float3 normal : NORMAL;
|
||||
};
|
||||
|
||||
struct v2f
|
||||
{
|
||||
LIGHTING_COORDS(0,1)
|
||||
float2 uv : TEXCOORD0;
|
||||
float4 pos : SV_POSITION;
|
||||
half3 worldNormal : NORMAL;
|
||||
float3 viewDir : TEXCOORD2;
|
||||
};
|
||||
|
||||
v2f vert (appdata v)
|
||||
{
|
||||
v2f o;
|
||||
o.pos = UnityObjectToClipPos(v.vertex);
|
||||
o.uv = TRANSFORM_TEX(v.uv, _MainTex);
|
||||
o.worldNormal = UnityObjectToWorldNormal(v.normal);
|
||||
o.viewDir = WorldSpaceViewDir(v.vertex);
|
||||
|
||||
TRANSFER_VERTEX_TO_FRAGMENT(o);
|
||||
return o;
|
||||
}
|
||||
|
||||
fixed4 frag (v2f i) : SV_Target
|
||||
{
|
||||
_MaxLight = max(_MinLight, _MaxLight);
|
||||
_Steps = _Segmented ? _Steps : 1;
|
||||
_StpSmooth = _Segmented ? _StpSmooth : 1;
|
||||
|
||||
_DarkColor = fixed4(0,0,0,1);
|
||||
_MaxAtten = 1.0;
|
||||
|
||||
float3 normal = normalize(i.worldNormal);
|
||||
float3 light_dir = normalize(_WorldSpaceLightPos0.xyz);
|
||||
float3 view_dir = normalize(i.viewDir);
|
||||
float3 halfVec = normalize(light_dir + view_dir);
|
||||
float3 forward = mul((float3x3)unity_CameraToWorld, float3(0,0,1));
|
||||
|
||||
float NdotL = dot(normal, light_dir);
|
||||
float NdotH = dot(normal, halfVec);
|
||||
float VdotN = dot(view_dir, normal);
|
||||
float FdotV = dot(forward, -view_dir);
|
||||
|
||||
fixed atten = SHADOW_ATTENUATION(i);
|
||||
float toon = Toon(NdotL, atten);
|
||||
|
||||
fixed4 shadecol = _DarkColor;
|
||||
fixed4 litcol = ColorBlend(_Color, _LightColor0, _AmbientCol);
|
||||
fixed4 texcol = tex2D(_MainTex, i.uv) * litcol * _ColIntense + _ColBright;
|
||||
|
||||
float4 blendCol = ColorBlend(shadecol, texcol, toon);
|
||||
float4 postCol = PostEffects(blendCol, toon, atten, NdotL, NdotH, VdotN, FdotV);
|
||||
|
||||
postCol.a = _Color.a;
|
||||
return postCol;
|
||||
}
|
||||
|
||||
ENDCG
|
||||
}
|
||||
|
||||
Pass
|
||||
{
|
||||
Tags { "LightMode" = "ForwardAdd" }
|
||||
BlendOp Max
|
||||
LOD 100
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#pragma multi_compile_fwdadd_fullshadows
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
#include "UnityLightingCommon.cginc"
|
||||
#include "AutoLight.cginc"
|
||||
#include "STCore.cginc"
|
||||
|
||||
struct appdata
|
||||
{
|
||||
float4 vertex : POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
float3 normal : NORMAL;
|
||||
};
|
||||
|
||||
struct v2f
|
||||
{
|
||||
LIGHTING_COORDS(0,1)
|
||||
float2 uv : TEXCOORDSS;
|
||||
float4 pos : SV_POSITION;
|
||||
float3 worldPos : WORLD;
|
||||
half3 worldNormal : NORMAL;
|
||||
float3 viewDir : TEXCOORD2;
|
||||
};
|
||||
|
||||
v2f vert (appdata v)
|
||||
{
|
||||
v2f o;
|
||||
o.pos = UnityObjectToClipPos(v.vertex);
|
||||
o.uv = TRANSFORM_TEX(v.uv, _MainTex);
|
||||
o.worldNormal = UnityObjectToWorldNormal(v.normal);
|
||||
o.worldPos = mul(unity_ObjectToWorld, v.vertex);
|
||||
o.viewDir = WorldSpaceViewDir(v.vertex);
|
||||
|
||||
TRANSFER_VERTEX_TO_FRAGMENT(o);
|
||||
return o;
|
||||
}
|
||||
|
||||
fixed4 frag (v2f i) : SV_Target
|
||||
{
|
||||
_MaxLight = max(_MinLight, _MaxLight);
|
||||
_Steps = _Segmented ? _Steps : 1;
|
||||
_StpSmooth = _Segmented ? _StpSmooth : 1;
|
||||
|
||||
_DarkColor = fixed4(0,0,0,1);
|
||||
_MaxAtten = 1.0;
|
||||
|
||||
float3 normal = normalize(i.worldNormal);
|
||||
float3 light_dir = normalize(_WorldSpaceLightPos0.xyz - i.worldPos.xyz);
|
||||
float3 view_dir = normalize(i.viewDir);
|
||||
float3 halfVec = normalize(light_dir + view_dir);
|
||||
float3 forward = mul((float3x3)unity_CameraToWorld, float3(0,0,1));
|
||||
|
||||
float NdotL = dot(normal, light_dir);
|
||||
float NdotH = dot(normal, halfVec);
|
||||
float VdotN = dot(view_dir, normal);
|
||||
float FdotV = dot(forward, -view_dir);
|
||||
|
||||
float atten = LIGHT_ATTENUATION(i);
|
||||
float toon = Toon(NdotL, atten);
|
||||
|
||||
fixed4 shadecol = _DarkColor;
|
||||
fixed4 litcol = ColorBlend(_Color, _LightColor0, _AmbientCol);
|
||||
fixed4 texcol = tex2D(_MainTex, i.uv) * litcol * _ColIntense + _ColBright;
|
||||
|
||||
float4 blendCol = ColorBlend(shadecol, texcol, toon);
|
||||
float4 postCol = PostEffects(blendCol, toon, atten, NdotL, NdotH, VdotN, FdotV);
|
||||
|
||||
postCol *= _Color.a;
|
||||
return postCol;
|
||||
}
|
||||
|
||||
ENDCG
|
||||
}
|
||||
|
||||
UsePass "Legacy Shaders/VertexLit/SHADOWCASTER"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 481153b840b6e408da95e6afbe176397
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -3,6 +3,7 @@
|
||||
"com.unity.collab-proxy": "2.5.1",
|
||||
"com.unity.feature.development": "1.0.1",
|
||||
"com.unity.nuget.newtonsoft-json": "3.2.1",
|
||||
"com.unity.postprocessing": "3.4.0",
|
||||
"com.unity.textmeshpro": "3.0.9",
|
||||
"com.unity.timeline": "1.7.6",
|
||||
"com.unity.ugui": "1.0.0",
|
||||
|
||||
@@ -74,6 +74,15 @@
|
||||
"dependencies": {},
|
||||
"url": "https://packages.unity.cn"
|
||||
},
|
||||
"com.unity.postprocessing": {
|
||||
"version": "3.4.0",
|
||||
"depth": 0,
|
||||
"source": "registry",
|
||||
"dependencies": {
|
||||
"com.unity.modules.physics": "1.0.0"
|
||||
},
|
||||
"url": "https://packages.unity.cn"
|
||||
},
|
||||
"com.unity.settings-manager": {
|
||||
"version": "2.0.1",
|
||||
"depth": 2,
|
||||
|
||||
@@ -77,7 +77,7 @@ PlayerSettings:
|
||||
androidMinimumWindowHeight: 300
|
||||
androidFullscreenMode: 1
|
||||
androidAutoRotationBehavior: 1
|
||||
defaultIsNativeResolution: 1
|
||||
defaultIsNativeResolution: 0
|
||||
macRetinaSupport: 1
|
||||
runInBackground: 1
|
||||
captureSingleScreen: 0
|
||||
@@ -645,7 +645,20 @@ PlayerSettings:
|
||||
webGLMemoryGeometricGrowthStep: 0.2
|
||||
webGLMemoryGeometricGrowthCap: 96
|
||||
webGLPowerPreference: 2
|
||||
scriptingDefineSymbols: {}
|
||||
scriptingDefineSymbols:
|
||||
Android: UNITY_POST_PROCESSING_STACK_V2
|
||||
EmbeddedLinux: UNITY_POST_PROCESSING_STACK_V2
|
||||
GameCoreXboxOne: UNITY_POST_PROCESSING_STACK_V2
|
||||
Nintendo Switch: UNITY_POST_PROCESSING_STACK_V2
|
||||
PS4: UNITY_POST_PROCESSING_STACK_V2
|
||||
PS5: UNITY_POST_PROCESSING_STACK_V2
|
||||
QNX: UNITY_POST_PROCESSING_STACK_V2
|
||||
Stadia: UNITY_POST_PROCESSING_STACK_V2
|
||||
Standalone: UNITY_POST_PROCESSING_STACK_V2
|
||||
VisionOS: UNITY_POST_PROCESSING_STACK_V2
|
||||
WebGL: UNITY_POST_PROCESSING_STACK_V2
|
||||
XboxOne: UNITY_POST_PROCESSING_STACK_V2
|
||||
tvOS: UNITY_POST_PROCESSING_STACK_V2
|
||||
additionalCompilerArguments: {}
|
||||
platformArchitecture: {}
|
||||
scriptingBackend:
|
||||
|
||||
@@ -11,7 +11,7 @@ TagManager:
|
||||
-
|
||||
- Water
|
||||
- UI
|
||||
-
|
||||
- Post-Pocessing
|
||||
-
|
||||
-
|
||||
-
|
||||
|
||||
Reference in new issue
Block a user