initial commit
This commit is contained in:
@@ -0,0 +1,78 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!21 &2100000
|
||||
Material:
|
||||
serializedVersion: 6
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: InvisibleMaterial
|
||||
m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_ShaderKeywords: _ALPHATEST_ON
|
||||
m_LightmapFlags: 4
|
||||
m_EnableInstancingVariants: 0
|
||||
m_DoubleSidedGI: 0
|
||||
m_CustomRenderQueue: 2450
|
||||
stringTagMap:
|
||||
RenderType: TransparentCutout
|
||||
disabledShaderPasses: []
|
||||
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_Floats:
|
||||
- _BumpScale: 1
|
||||
- _Cutoff: 0.5
|
||||
- _DetailNormalMapScale: 1
|
||||
- _DstBlend: 0
|
||||
- _GlossMapScale: 1
|
||||
- _Glossiness: 0.5
|
||||
- _GlossyReflections: 1
|
||||
- _Metallic: 0
|
||||
- _Mode: 1
|
||||
- _OcclusionStrength: 1
|
||||
- _Parallax: 0.02
|
||||
- _SmoothnessTextureChannel: 0
|
||||
- _SpecularHighlights: 1
|
||||
- _SrcBlend: 1
|
||||
- _UVSec: 0
|
||||
- _ZWrite: 1
|
||||
m_Colors:
|
||||
- _Color: {r: 1, g: 1, b: 1, a: 0}
|
||||
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 822a9b0732637f04b88e39818d097a19
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,79 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!21 &2100000
|
||||
Material:
|
||||
serializedVersion: 6
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: New Material
|
||||
m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_ShaderKeywords: _ALPHAPREMULTIPLY_ON
|
||||
m_LightmapFlags: 4
|
||||
m_EnableInstancingVariants: 0
|
||||
m_DoubleSidedGI: 0
|
||||
m_CustomRenderQueue: 3000
|
||||
stringTagMap:
|
||||
RenderType: Transparent
|
||||
disabledShaderPasses: []
|
||||
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_Floats:
|
||||
- _BumpScale: 1
|
||||
- _Cutoff: 0.5
|
||||
- _DetailNormalMapScale: 1
|
||||
- _DstBlend: 10
|
||||
- _GlossMapScale: 1
|
||||
- _Glossiness: 0.5
|
||||
- _GlossyReflections: 1
|
||||
- _Metallic: 0
|
||||
- _Mode: 3
|
||||
- _OcclusionStrength: 1
|
||||
- _Parallax: 0.02
|
||||
- _SmoothnessTextureChannel: 0
|
||||
- _SpecularHighlights: 1
|
||||
- _SrcBlend: 1
|
||||
- _UVSec: 0
|
||||
- _ZWrite: 0
|
||||
m_Colors:
|
||||
- _Color: {r: 1, g: 0, b: 0, a: 0.14901961}
|
||||
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
|
||||
m_BuildTextureStacks: []
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 679e2894c1678ec429166a86a676a44d
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 2100000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,196 @@
|
||||
|
||||
Shader "Uma/Base" {
|
||||
Properties {
|
||||
_MainTex ("Diffuse (_diff)", 2D) = "white" {}
|
||||
_ShadTex ("Shaded (_shad_c)", 2D) = "black" {}
|
||||
_BaseTex ("Base Map (_base)", 2D) = "white" {}
|
||||
_CtrlTex ("Control Map (_ctrl)", 2D) = "white" {}
|
||||
_OutlineWidth ("Outline Width", float) = 2.0
|
||||
[HideInInspector] _OutlineColor ("Outline Color", Color) = (0.125,0.047,0,0.098)
|
||||
}
|
||||
SubShader {
|
||||
Tags {
|
||||
"RenderType"="Transparent"
|
||||
"VRCFallback"="ToonCutout"
|
||||
}
|
||||
|
||||
Pass {
|
||||
Name "Forward"
|
||||
Tags {
|
||||
"LightMode"="ForwardBase"
|
||||
}
|
||||
Cull Off
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#include "UnityCG.cginc"
|
||||
#include "AutoLight.cginc"
|
||||
#include "Lighting.cginc"
|
||||
|
||||
// Standard diffuse
|
||||
uniform sampler2D _MainTex;
|
||||
uniform float4 _MainTex_ST;
|
||||
// Shaded version of diffuse
|
||||
uniform sampler2D _ShadTex;
|
||||
uniform float4 _ShadTex_ST;
|
||||
// Red: Ambient Occlusion, Green: Specular, Blue: Clip
|
||||
uniform sampler2D _BaseTex;
|
||||
uniform float4 _BaseTex_ST;
|
||||
// Red: Unused?, Green: Metal?, Blue: Some sort of shading? Rimlight?
|
||||
uniform sampler2D _CtrlTex;
|
||||
uniform float4 _CtrlTex_ST;
|
||||
|
||||
struct VertexInput {
|
||||
float4 vertex : POSITION;
|
||||
float3 normal : NORMAL;
|
||||
float2 texcoord0 : TEXCOORD0;
|
||||
};
|
||||
struct VertexOutput {
|
||||
float4 pos: SV_POSITION;
|
||||
float2 uv0 : TEXCOORD0;
|
||||
float4 posWorld : TEXCOORD1;
|
||||
float3 normalDir : TEXCOORD2;
|
||||
};
|
||||
|
||||
VertexOutput vert (VertexInput v) {
|
||||
VertexOutput o;
|
||||
o.uv0 = v.texcoord0;
|
||||
o.pos = UnityObjectToClipPos(v.vertex.xyz);
|
||||
o.posWorld = mul(unity_ObjectToWorld, v.vertex);
|
||||
o.normalDir = UnityObjectToWorldNormal(v.normal);
|
||||
TRANSFER_VERTEX_TO_FRAGMENT(o)
|
||||
return o;
|
||||
}
|
||||
|
||||
float4 frag (VertexOutput i): COLOR {
|
||||
float4 diff = tex2D(_MainTex, TRANSFORM_TEX(i.uv0, _MainTex));
|
||||
float4 shad = tex2D(_ShadTex, TRANSFORM_TEX(i.uv0, _ShadTex));
|
||||
float4 base = tex2D(_BaseTex, TRANSFORM_TEX(i.uv0, _BaseTex));
|
||||
float4 ctrl = tex2D(_CtrlTex, TRANSFORM_TEX(i.uv0, _CtrlTex));
|
||||
|
||||
float3 viewDirection = normalize(_WorldSpaceCameraPos.xyz - i.posWorld.xyz);
|
||||
float facing = dot(i.normalDir, viewDirection);
|
||||
|
||||
// Lighting
|
||||
float3 lightDirection = normalize(lerp(_WorldSpaceLightPos0.xyz, _WorldSpaceLightPos0.xyz - i.posWorld.xyz, _WorldSpaceLightPos0.w));
|
||||
float halfLambert = 0.5 * dot(i.normalDir, lightDirection) + 0.5;
|
||||
float shadowLerp = saturate(1 + ((base.r * 2 * halfLambert - 0.2) * 100));
|
||||
float3 lightColor = saturate(max(_LightColor0, max(ShadeSH9(half4(0, 0, 0, 1)).rgb, ShadeSH9(half4(0, -1, 0, 1)).rgb)));
|
||||
float4 shadedDiff = lerp(shad, diff, shadowLerp) * fixed4(lightColor, 1);
|
||||
|
||||
// Specular
|
||||
float specularMult = 1 + saturate(base.g * 50 * (facing - 0.6));
|
||||
|
||||
// Rim
|
||||
float rimLerp = (1 - saturate(facing * 8)) * ctrl.b;
|
||||
float4 rimColor = diff * 10;
|
||||
|
||||
clip(base.b - 0.5);
|
||||
|
||||
return shadedDiff * specularMult * lerp(float4(1, 1, 1, 1), rimColor, rimLerp);
|
||||
}
|
||||
|
||||
ENDCG
|
||||
}
|
||||
|
||||
Pass {
|
||||
Name "Outline"
|
||||
Tags {
|
||||
}
|
||||
Cull Front
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#include "UnityCG.cginc"
|
||||
#include "Lighting.cginc"
|
||||
|
||||
uniform sampler2D _MainTex;
|
||||
uniform float4 _MainTex_ST;
|
||||
uniform sampler2D _BaseTex;
|
||||
uniform float4 _BaseTex_ST;
|
||||
|
||||
uniform float _OutlineWidth;
|
||||
uniform float4 _OutlineColor;
|
||||
|
||||
struct VertexInput {
|
||||
float4 vertex : POSITION;
|
||||
float3 normal : NORMAL;
|
||||
float2 texcoord0 : TEXCOORD0;
|
||||
};
|
||||
struct VertexOutput {
|
||||
float4 pos : SV_POSITION;
|
||||
float2 uv0 : TEXCOORD0;
|
||||
float4 posWorld : TEXCOORD1;
|
||||
};
|
||||
|
||||
VertexOutput vert (VertexInput v) {
|
||||
VertexOutput o = (VertexOutput)0;
|
||||
float outlineScale = _OutlineWidth * 0.001;
|
||||
o.pos = UnityObjectToClipPos(float4(v.vertex.xyz + v.normal * outlineScale, 1));
|
||||
o.uv0 = v.texcoord0;
|
||||
o.posWorld = mul(unity_ObjectToWorld, v.vertex);
|
||||
return o;
|
||||
}
|
||||
|
||||
float4 frag(VertexOutput i): COLOR {
|
||||
float4 diff = tex2D(_MainTex, TRANSFORM_TEX(i.uv0, _MainTex));
|
||||
float4 base = tex2D(_BaseTex, TRANSFORM_TEX(i.uv0, _BaseTex));
|
||||
|
||||
float3 lightColor = saturate(max(_LightColor0, max(ShadeSH9(half4(0, 0, 0, 1)).rgb, ShadeSH9(half4(0, -1, 0, 1)).rgb)));
|
||||
float4 outlineColor = lerp(_OutlineColor, diff, 0.2) * fixed4(lightColor, 1);
|
||||
|
||||
clip(base.b - 0.5);
|
||||
|
||||
return fixed4(outlineColor.rgb, 1);
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
|
||||
Pass {
|
||||
Name "ShadowCaster"
|
||||
Tags {
|
||||
"LightMode"="ShadowCaster"
|
||||
}
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#define UNITY_PASS_SHADOWCASTER
|
||||
#include "UnityCG.cginc"
|
||||
#include "Lighting.cginc"
|
||||
|
||||
uniform sampler2D _BaseTex;
|
||||
uniform float4 _BaseTex_ST;
|
||||
|
||||
struct VertexInput {
|
||||
float4 vertex : POSITION;
|
||||
float2 texcoord0 : TEXCOORD0;
|
||||
};
|
||||
struct VertexOutput {
|
||||
V2F_SHADOW_CASTER;
|
||||
float2 uv0 : TEXCOORD1;
|
||||
};
|
||||
|
||||
VertexOutput vert (VertexInput v) {
|
||||
VertexOutput o;
|
||||
o.uv0 = v.texcoord0;
|
||||
o.pos = UnityObjectToClipPos(v.vertex);
|
||||
TRANSFER_SHADOW_CASTER(o);
|
||||
return o;
|
||||
}
|
||||
|
||||
float4 frag(VertexOutput i): COLOR {
|
||||
float4 base = tex2D(_BaseTex, TRANSFORM_TEX(i.uv0, _BaseTex));
|
||||
|
||||
clip(base.b - 0.5);
|
||||
|
||||
SHADOW_CASTER_FRAGMENT(i);
|
||||
}
|
||||
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
FallBack "Diffuse"
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e33c55b5d7d517442a6d826f7e14e969
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
preprocessorOverride: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,125 @@
|
||||
|
||||
Shader "Uma/Eye" {
|
||||
Properties {
|
||||
_MainTex ("Eye Diffuse (_eye0)", 2D) = "white" {}
|
||||
_Highlight00 ("Highlight #1 (_hi00)", 2D) = "black" {}
|
||||
_Highlight01 ("Highlight #2 (_hi01)", 2D) = "black" {}
|
||||
_Highlight02 ("Highlight #3 (_hi02)", 2D) = "black" {}
|
||||
_EyeSelect ("Eye Select", Int) = 0
|
||||
_Show00 ("Show #1", Range(0.01, 1)) = 0.35
|
||||
_Show01 ("Show #2", Range(0.01, 1)) = 0.35
|
||||
}
|
||||
SubShader {
|
||||
Tags {
|
||||
"RenderType"="Transparent"
|
||||
"VRCFallback"="ToonCutout"
|
||||
}
|
||||
|
||||
Pass {
|
||||
Name "Forward"
|
||||
Tags {
|
||||
"LightMode"="ForwardBase"
|
||||
}
|
||||
Cull Off
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#include "UnityCG.cginc"
|
||||
#include "AutoLight.cginc"
|
||||
#include "Lighting.cginc"
|
||||
|
||||
// Standard diffuse
|
||||
uniform sampler2D _MainTex;
|
||||
uniform float4 _MainTex_ST;
|
||||
uniform sampler2D _Highlight00;
|
||||
uniform float4 _Highlight00_ST;
|
||||
uniform sampler2D _Highlight01;
|
||||
uniform float4 _Highlight01_ST;
|
||||
uniform sampler2D _Highlight02;
|
||||
uniform float4 _Highlight02_ST;
|
||||
|
||||
int _EyeSelect;
|
||||
|
||||
float _Show00;
|
||||
float _Show01;
|
||||
|
||||
struct VertexInput {
|
||||
float4 vertex : POSITION;
|
||||
float3 normal : NORMAL;
|
||||
float2 texcoord0 : TEXCOORD0;
|
||||
};
|
||||
struct VertexOutput {
|
||||
float4 pos: SV_POSITION;
|
||||
float2 uv0 : TEXCOORD0;
|
||||
float4 posWorld : TEXCOORD1;
|
||||
float3 normalDir : TEXCOORD2;
|
||||
};
|
||||
|
||||
VertexOutput vert (VertexInput v) {
|
||||
VertexOutput o;
|
||||
o.uv0 = v.texcoord0;
|
||||
o.pos = UnityObjectToClipPos(v.vertex.xyz);
|
||||
o.posWorld = mul(unity_ObjectToWorld, v.vertex);
|
||||
o.normalDir = UnityObjectToWorldNormal(v.normal);
|
||||
TRANSFER_VERTEX_TO_FRAGMENT(o)
|
||||
return o;
|
||||
}
|
||||
|
||||
float4 frag (VertexOutput i): COLOR {
|
||||
float2 eyeUv = float2(i.uv0.x + (_EyeSelect * 0.25), i.uv0.y);
|
||||
float4 diff = tex2D(_MainTex, TRANSFORM_TEX(eyeUv, _MainTex));
|
||||
float2 altUv = float2(i.uv0.x * 4, i.uv0.y * 2);
|
||||
float4 hi00 = tex2D(_Highlight00, TRANSFORM_TEX(altUv, _Highlight00));
|
||||
float4 hi01 = tex2D(_Highlight01, TRANSFORM_TEX(altUv, _Highlight01));
|
||||
float4 hi02 = tex2D(_Highlight02, TRANSFORM_TEX(altUv, _Highlight02));
|
||||
|
||||
float4 hl00 = step(_Show00, hi00);
|
||||
float4 hl01 = step(_Show01, hi01);
|
||||
|
||||
float3 lightColor = saturate(max(_LightColor0, max(ShadeSH9(half4(0, 0, 0, 1)).rgb, ShadeSH9(half4(0, -1, 0, 1)).rgb)));
|
||||
return (diff + hl00 + hl01) * fixed4(lightColor, 1);
|
||||
}
|
||||
|
||||
ENDCG
|
||||
}
|
||||
|
||||
Pass {
|
||||
Name "ShadowCaster"
|
||||
Tags {
|
||||
"LightMode"="ShadowCaster"
|
||||
}
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#define UNITY_PASS_SHADOWCASTER
|
||||
#include "UnityCG.cginc"
|
||||
#include "Lighting.cginc"
|
||||
|
||||
struct VertexInput {
|
||||
float4 vertex : POSITION;
|
||||
float2 texcoord0 : TEXCOORD0;
|
||||
};
|
||||
struct VertexOutput {
|
||||
V2F_SHADOW_CASTER;
|
||||
float2 uv0 : TEXCOORD1;
|
||||
};
|
||||
|
||||
VertexOutput vert (VertexInput v) {
|
||||
VertexOutput o;
|
||||
o.uv0 = v.texcoord0;
|
||||
o.pos = UnityObjectToClipPos(v.vertex);
|
||||
TRANSFER_SHADOW_CASTER(o);
|
||||
return o;
|
||||
}
|
||||
|
||||
float4 frag(VertexOutput i): COLOR {
|
||||
SHADOW_CASTER_FRAGMENT(i);
|
||||
}
|
||||
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
FallBack "Diffuse"
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 09e6d87c36af83746a4eded3b2751afe
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
preprocessorOverride: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,128 @@
|
||||
|
||||
Shader "Uma/Face" {
|
||||
Properties {
|
||||
_MainTex ("Diffuse (_diff)", 2D) = "white" {}
|
||||
_ShadTex ("Shaded (_shad_c)", 2D) = "black" {}
|
||||
_BaseTex ("Base Map (_base)", 2D) = "white" {}
|
||||
_CtrlTex ("Control Map (_ctrl)", 2D) = "white" {}
|
||||
}
|
||||
SubShader {
|
||||
Tags {
|
||||
"RenderType"="Transparent"
|
||||
"VRCFallback"="ToonCutout"
|
||||
}
|
||||
|
||||
Pass {
|
||||
Name "Forward"
|
||||
Tags {
|
||||
"LightMode"="ForwardBase"
|
||||
}
|
||||
Cull Off
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#include "UnityCG.cginc"
|
||||
#include "AutoLight.cginc"
|
||||
#include "Lighting.cginc"
|
||||
|
||||
// Standard diffuse
|
||||
uniform sampler2D _MainTex;
|
||||
uniform float4 _MainTex_ST;
|
||||
// Shaded version of diffuse
|
||||
uniform sampler2D _ShadTex;
|
||||
uniform float4 _ShadTex_ST;
|
||||
// ??
|
||||
uniform sampler2D _BaseTex;
|
||||
uniform float4 _BaseTex_ST;
|
||||
// ??
|
||||
uniform sampler2D _CtrlTex;
|
||||
uniform float4 _CtrlTex_ST;
|
||||
|
||||
struct VertexInput {
|
||||
float4 vertex : POSITION;
|
||||
float3 normal : NORMAL;
|
||||
float2 texcoord0 : TEXCOORD0;
|
||||
};
|
||||
struct VertexOutput {
|
||||
float4 pos: SV_POSITION;
|
||||
float2 uv0 : TEXCOORD0;
|
||||
float4 posWorld : TEXCOORD1;
|
||||
float3 normalDir : TEXCOORD2;
|
||||
};
|
||||
|
||||
VertexOutput vert (VertexInput v) {
|
||||
VertexOutput o;
|
||||
o.uv0 = v.texcoord0;
|
||||
o.pos = UnityObjectToClipPos(v.vertex.xyz);
|
||||
o.posWorld = mul(unity_ObjectToWorld, v.vertex);
|
||||
o.normalDir = UnityObjectToWorldNormal(v.normal);
|
||||
TRANSFER_VERTEX_TO_FRAGMENT(o)
|
||||
return o;
|
||||
}
|
||||
|
||||
float4 frag (VertexOutput i): COLOR {
|
||||
float4 diff = tex2D(_MainTex, TRANSFORM_TEX(i.uv0, _MainTex));
|
||||
float4 shad = tex2D(_ShadTex, TRANSFORM_TEX(i.uv0, _ShadTex));
|
||||
float4 base = tex2D(_BaseTex, TRANSFORM_TEX(i.uv0, _BaseTex));
|
||||
float4 ctrl = tex2D(_CtrlTex, TRANSFORM_TEX(i.uv0, _CtrlTex));
|
||||
|
||||
float3 viewDirection = normalize(_WorldSpaceCameraPos.xyz - i.posWorld.xyz);
|
||||
float facing = dot(i.normalDir, viewDirection);
|
||||
|
||||
// Lighting
|
||||
float3 lightDirection = float3(0, -1, 0);
|
||||
float halfLambert = 0.5 * dot(i.normalDir, lightDirection) + 0.5;
|
||||
float shadowLerp = saturate(1 + ((base.r * 2 * halfLambert - 0.3) * 50));
|
||||
float3 lightColor = saturate(max(_LightColor0, max(ShadeSH9(half4(0, 0, 0, 1)).rgb, ShadeSH9(half4(0, -1, 0, 1)).rgb)));
|
||||
float4 shadedDiff = lerp(shad, diff, shadowLerp) * fixed4(lightColor, 1);
|
||||
|
||||
// Rim
|
||||
float rimLerp = (1 - saturate(facing * 8)) * ctrl.b;
|
||||
float4 rimColor = diff * 10;
|
||||
|
||||
return shadedDiff * lerp(float4(1, 1, 1, 1), rimColor, rimLerp);
|
||||
}
|
||||
|
||||
ENDCG
|
||||
}
|
||||
|
||||
Pass {
|
||||
Name "ShadowCaster"
|
||||
Tags {
|
||||
"LightMode"="ShadowCaster"
|
||||
}
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#define UNITY_PASS_SHADOWCASTER
|
||||
#include "UnityCG.cginc"
|
||||
#include "Lighting.cginc"
|
||||
|
||||
struct VertexInput {
|
||||
float4 vertex : POSITION;
|
||||
float2 texcoord0 : TEXCOORD0;
|
||||
};
|
||||
struct VertexOutput {
|
||||
V2F_SHADOW_CASTER;
|
||||
float2 uv0 : TEXCOORD1;
|
||||
};
|
||||
|
||||
VertexOutput vert (VertexInput v) {
|
||||
VertexOutput o;
|
||||
o.uv0 = v.texcoord0;
|
||||
o.pos = UnityObjectToClipPos(v.vertex);
|
||||
TRANSFER_SHADOW_CASTER(o);
|
||||
return o;
|
||||
}
|
||||
|
||||
float4 frag(VertexOutput i): COLOR {
|
||||
SHADOW_CASTER_FRAGMENT(i);
|
||||
}
|
||||
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
FallBack "Diffuse"
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8dd9a36995719164398728c3117a5cf8
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
preprocessorOverride: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,166 @@
|
||||
|
||||
Shader "Uma/Tail" {
|
||||
Properties {
|
||||
_MainTex ("Diffuse (_diff)", 2D) = "white" {}
|
||||
_ShadTex ("Shaded (_shad_c)", 2D) = "black" {}
|
||||
_OutlineWidth ("Outline Width", float) = 2.0
|
||||
[HideInInspector] _OutlineColor ("Outline Color", Color) = (0.125,0.047,0,0.098)
|
||||
}
|
||||
SubShader {
|
||||
Tags {
|
||||
"RenderType"="Transparent"
|
||||
"VRCFallback"="ToonCutout"
|
||||
}
|
||||
|
||||
Pass {
|
||||
Name "Forward"
|
||||
Tags {
|
||||
"LightMode"="ForwardBase"
|
||||
}
|
||||
Cull Off
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#include "UnityCG.cginc"
|
||||
#include "AutoLight.cginc"
|
||||
#include "Lighting.cginc"
|
||||
|
||||
// Standard diffuse
|
||||
uniform sampler2D _MainTex;
|
||||
uniform float4 _MainTex_ST;
|
||||
// Shaded version of diffuse
|
||||
uniform sampler2D _ShadTex;
|
||||
uniform float4 _ShadTex_ST;
|
||||
|
||||
struct VertexInput {
|
||||
float4 vertex : POSITION;
|
||||
float3 normal : NORMAL;
|
||||
float2 texcoord0 : TEXCOORD0;
|
||||
};
|
||||
struct VertexOutput {
|
||||
float4 pos: SV_POSITION;
|
||||
float2 uv0 : TEXCOORD0;
|
||||
float4 posWorld : TEXCOORD1;
|
||||
float3 normalDir : TEXCOORD2;
|
||||
};
|
||||
|
||||
VertexOutput vert (VertexInput v) {
|
||||
VertexOutput o;
|
||||
o.uv0 = v.texcoord0;
|
||||
o.pos = UnityObjectToClipPos(v.vertex.xyz);
|
||||
o.posWorld = mul(unity_ObjectToWorld, v.vertex);
|
||||
o.normalDir = UnityObjectToWorldNormal(v.normal);
|
||||
TRANSFER_VERTEX_TO_FRAGMENT(o)
|
||||
return o;
|
||||
}
|
||||
|
||||
float4 frag (VertexOutput i): COLOR {
|
||||
float4 diff = tex2D(_MainTex, TRANSFORM_TEX(i.uv0, _MainTex));
|
||||
float4 shad = tex2D(_ShadTex, TRANSFORM_TEX(i.uv0, _ShadTex));
|
||||
|
||||
float3 viewDirection = normalize(_WorldSpaceCameraPos.xyz - i.posWorld.xyz);
|
||||
float facing = dot(i.normalDir, viewDirection);
|
||||
|
||||
// Lighting
|
||||
float3 lightDirection = normalize(lerp(_WorldSpaceLightPos0.xyz, _WorldSpaceLightPos0.xyz - i.posWorld.xyz, _WorldSpaceLightPos0.w));
|
||||
float halfLambert = 0.5 * dot(i.normalDir, lightDirection) + 0.5;
|
||||
float shadowLerp = saturate(1 + ((2 * halfLambert - 0.2) * 100));
|
||||
float3 lightColor = saturate(max(_LightColor0, max(ShadeSH9(half4(0, 0, 0, 1)).rgb, ShadeSH9(half4(0, -1, 0, 1)).rgb)));
|
||||
float4 shadedDiff = lerp(shad, diff, shadowLerp) * fixed4(lightColor, 1);
|
||||
|
||||
return shadedDiff;
|
||||
}
|
||||
|
||||
ENDCG
|
||||
}
|
||||
|
||||
Pass {
|
||||
Name "Outline"
|
||||
Tags {
|
||||
}
|
||||
Offset 1, 1
|
||||
Cull Front
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#include "UnityCG.cginc"
|
||||
#include "Lighting.cginc"
|
||||
|
||||
uniform sampler2D _MainTex;
|
||||
uniform float4 _MainTex_ST;
|
||||
|
||||
uniform float _OutlineWidth;
|
||||
uniform float4 _OutlineColor;
|
||||
|
||||
struct VertexInput {
|
||||
float4 vertex : POSITION;
|
||||
float3 normal : NORMAL;
|
||||
float2 texcoord0 : TEXCOORD0;
|
||||
};
|
||||
struct VertexOutput {
|
||||
float4 pos : SV_POSITION;
|
||||
float2 uv0 : TEXCOORD0;
|
||||
float4 posWorld : TEXCOORD1;
|
||||
};
|
||||
|
||||
VertexOutput vert (VertexInput v) {
|
||||
VertexOutput o = (VertexOutput)0;
|
||||
float outlineScale = _OutlineWidth * 0.001;
|
||||
o.pos = UnityObjectToClipPos(float4(v.vertex.xyz + v.normal * outlineScale, 1));
|
||||
o.uv0 = v.texcoord0;
|
||||
o.posWorld = mul(unity_ObjectToWorld, v.vertex);
|
||||
return o;
|
||||
}
|
||||
|
||||
float4 frag(VertexOutput i): COLOR {
|
||||
float4 diff = tex2D(_MainTex, TRANSFORM_TEX(i.uv0, _MainTex));
|
||||
|
||||
float3 lightColor = saturate(max(_LightColor0, max(ShadeSH9(half4(0, 0, 0, 1)).rgb, ShadeSH9(half4(0, -1, 0, 1)).rgb)));
|
||||
float4 outlineColor = lerp(_OutlineColor, diff, 0.2) * fixed4(lightColor, 1);
|
||||
|
||||
return fixed4(outlineColor.rgb, 1);
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
|
||||
Pass {
|
||||
Name "ShadowCaster"
|
||||
Tags {
|
||||
"LightMode"="ShadowCaster"
|
||||
}
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#define UNITY_PASS_SHADOWCASTER
|
||||
#include "UnityCG.cginc"
|
||||
#include "Lighting.cginc"
|
||||
|
||||
struct VertexInput {
|
||||
float4 vertex : POSITION;
|
||||
float2 texcoord0 : TEXCOORD0;
|
||||
};
|
||||
struct VertexOutput {
|
||||
V2F_SHADOW_CASTER;
|
||||
float2 uv0 : TEXCOORD1;
|
||||
};
|
||||
|
||||
VertexOutput vert (VertexInput v) {
|
||||
VertexOutput o;
|
||||
o.uv0 = v.texcoord0;
|
||||
o.pos = UnityObjectToClipPos(v.vertex);
|
||||
TRANSFER_SHADOW_CASTER(o);
|
||||
return o;
|
||||
}
|
||||
|
||||
float4 frag(VertexOutput i): COLOR {
|
||||
SHADOW_CASTER_FRAGMENT(i);
|
||||
}
|
||||
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
FallBack "Diffuse"
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 521ea3109ac72d04f8ebea353d6f7d9d
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
preprocessorOverride: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user