chrisgregan
10 years ago
5 changed files with 209 additions and 0 deletions
@ -0,0 +1,5 @@
|
||||
fileFormatVersion: 2 |
||||
guid: afac93db866671940819cd3ecaa302dc |
||||
folderAsset: yes |
||||
DefaultImporter: |
||||
userData: |
@ -0,0 +1,89 @@
|
||||
Shader "Custom/Cross Fade" |
||||
{ |
||||
Properties |
||||
{ |
||||
[PerRendererData] _MainTex ("Sprite Texture", 2D) = "white" {} |
||||
_TexStart ("Start Texture ", 2D) = "white" {} |
||||
_TexEnd ("End Texture", 2D) = "white" {} |
||||
_Fade ("Fade", Range(0, 1)) = 0 |
||||
_Alpha ("Alpha", Range(0, 1)) = 1 |
||||
_Color ("Tint", Color) = (1,1,1,1) |
||||
[MaterialToggle] _FlipStart("Flip Start Texture", Float) = 0 |
||||
[MaterialToggle] _FlipEnd("Flip End Texture", Float) = 0 |
||||
} |
||||
|
||||
SubShader |
||||
{ |
||||
Tags |
||||
{ |
||||
"Queue" = "Transparent" |
||||
"IgnoreProjector"="True" |
||||
"RenderType" = "Transparent" |
||||
"PreviewType"="Plane" |
||||
"CanUseSpriteAtlas"="True" |
||||
"ForceNoShadowCasting"="True" |
||||
} |
||||
Cull Off |
||||
ZWrite Off |
||||
Blend One OneMinusSrcAlpha |
||||
Pass |
||||
{ |
||||
CGPROGRAM |
||||
#pragma vertex vert |
||||
#pragma fragment frag |
||||
#pragma fragmentoption ARB_precision_hint_fastest |
||||
#include "UnityCG.cginc" |
||||
|
||||
sampler2D _MainTex; |
||||
fixed4 _MainTex_ST; |
||||
sampler2D _TexStart; |
||||
fixed4 _TexStart_ST; |
||||
sampler2D _TexEnd; |
||||
fixed4 _TexEnd_ST; |
||||
float _Fade; |
||||
float _Alpha; |
||||
fixed4 _Color; |
||||
float _FlipStart; |
||||
float _FlipEnd; |
||||
|
||||
struct appdata_t |
||||
{ |
||||
float4 vertex : POSITION; |
||||
float2 texcoord : TEXCOORD0; |
||||
fixed4 color : COLOR; |
||||
}; |
||||
|
||||
struct v2f |
||||
{ |
||||
float4 vertex : POSITION; |
||||
float2 texcoord : TEXCOORD0; |
||||
fixed4 color : COLOR; |
||||
}; |
||||
|
||||
v2f vert(appdata_t IN) |
||||
{ |
||||
v2f OUT; |
||||
OUT.vertex = mul(UNITY_MATRIX_MVP, IN.vertex); |
||||
OUT.texcoord = TRANSFORM_TEX(IN.texcoord, _MainTex); |
||||
OUT.color = IN.color * _Color; |
||||
return OUT; |
||||
} |
||||
|
||||
fixed4 frag (v2f i) : COLOR |
||||
{ |
||||
float2 start_uv = float2( i.texcoord.x, i.texcoord.y ); |
||||
float2 end_uv = float2( i.texcoord.x, i.texcoord.y ); |
||||
if ( _FlipStart != 0 ) |
||||
start_uv = float2( 1.0 - i.texcoord.x, i.texcoord.y ); |
||||
if ( _FlipEnd != 0 ) |
||||
end_uv = float2( 1.0 - i.texcoord.x, i.texcoord.y ); |
||||
fixed4 texStart = tex2D(_TexStart, start_uv); |
||||
fixed4 texEnd = tex2D(_TexEnd, end_uv); |
||||
fixed4 crosstex = ( texStart * texStart.a * (1.0-_Fade) ) + ( texEnd * texEnd.a * _Fade ); |
||||
return (crosstex * i.color) * _Alpha; |
||||
} |
||||
ENDCG |
||||
} |
||||
} |
||||
Fallback off |
||||
} |
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2 |
||||
guid: 0bd2a5da5a3c2e94b95241a053a21199 |
||||
ShaderImporter: |
||||
defaultTextures: |
||||
- _MainTex: {instanceID: 0} |
||||
- _Tex1: {instanceID: 0} |
||||
- _Tex2: {instanceID: 0} |
||||
userData: |
@ -0,0 +1,103 @@
|
||||
%YAML 1.1 |
||||
%TAG !u! tag:unity3d.com,2011: |
||||
--- !u!21 &2100000 |
||||
Material: |
||||
serializedVersion: 3 |
||||
m_ObjectHideFlags: 0 |
||||
m_PrefabParentObject: {fileID: 0} |
||||
m_PrefabInternal: {fileID: 0} |
||||
m_Name: Portrait |
||||
m_Shader: {fileID: 4800000, guid: 0bd2a5da5a3c2e94b95241a053a21199, type: 3} |
||||
m_ShaderKeywords: [] |
||||
m_CustomRenderQueue: -1 |
||||
m_SavedProperties: |
||||
serializedVersion: 2 |
||||
m_TexEnvs: |
||||
data: |
||||
first: |
||||
name: _MainTex |
||||
second: |
||||
m_Texture: {fileID: 2800000, guid: c27113fd8a09c7c45a856e5d3c843c11, type: 3} |
||||
m_Scale: {x: 1, y: 1} |
||||
m_Offset: {x: 0, y: 0} |
||||
data: |
||||
first: |
||||
name: _BumpMap |
||||
second: |
||||
m_Texture: {fileID: 0} |
||||
m_Scale: {x: 1, y: 1} |
||||
m_Offset: {x: 0, y: 0} |
||||
data: |
||||
first: |
||||
name: _TexStart |
||||
second: |
||||
m_Texture: {fileID: 2800000, guid: bcd5b5f11de95ec4ba92005e4a404502, type: 3} |
||||
m_Scale: {x: 1, y: 1} |
||||
m_Offset: {x: 0, y: 0} |
||||
data: |
||||
first: |
||||
name: _TexEnd |
||||
second: |
||||
m_Texture: {fileID: 2800000, guid: f20cadd42b0548a4d8d2cd5b36223312, type: 3} |
||||
m_Scale: {x: 1, y: 1} |
||||
m_Offset: {x: 0, y: 0} |
||||
data: |
||||
first: |
||||
name: _Tex1 |
||||
second: |
||||
m_Texture: {fileID: 0} |
||||
m_Scale: {x: 1, y: 1} |
||||
m_Offset: {x: 0, y: 0} |
||||
data: |
||||
first: |
||||
name: _Tex2 |
||||
second: |
||||
m_Texture: {fileID: 0} |
||||
m_Scale: {x: 1, y: 1} |
||||
m_Offset: {x: 0, y: 0} |
||||
m_Floats: |
||||
data: |
||||
first: |
||||
name: PixelSnap |
||||
second: 0 |
||||
data: |
||||
first: |
||||
name: _Fade |
||||
second: 1 |
||||
data: |
||||
first: |
||||
name: _FlipStart |
||||
second: 0 |
||||
data: |
||||
first: |
||||
name: _FlipEnd |
||||
second: 0 |
||||
data: |
||||
first: |
||||
name: _Alpha |
||||
second: 1 |
||||
data: |
||||
first: |
||||
name: _flipStart |
||||
second: 0 |
||||
data: |
||||
first: |
||||
name: _flipEnd |
||||
second: 0 |
||||
data: |
||||
first: |
||||
name: _Opacity |
||||
second: 1 |
||||
m_Colors: |
||||
data: |
||||
first: |
||||
name: _Color |
||||
second: {r: 1, g: 1, b: 1, a: 1} |
||||
data: |
||||
first: |
||||
name: _StartColor |
||||
second: {r: 1, g: 1, b: 1, a: 1} |
||||
data: |
||||
first: |
||||
name: _EndColor |
||||
second: {r: 1, g: 1, b: 1, a: 1} |
Loading…
Reference in new issue