generated from raccoon/vrchat-project-template
All new shaders
This commit is contained in:
83
Assets/dbl-world/shaders/minecraft/unlitAnim.shader
Normal file
83
Assets/dbl-world/shaders/minecraft/unlitAnim.shader
Normal file
@@ -0,0 +1,83 @@
|
||||
Shader "Custom/Minecraft/Unlit Animated"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
[NoScaleOffset]_TextureArray("Texture Array (RGBA)", 2DArray) = "" {}
|
||||
_Cutoff ("Alpha Cutoff", Range(0,1)) = 0.5
|
||||
_Color("Tint Color", Color) = (1, 1, 1, 1)
|
||||
_FlipbookFPS("Flipbook FPS", Integer) = 30
|
||||
_FlipbookFrames("Flipbook Frames", Integer) = 30
|
||||
}
|
||||
SubShader
|
||||
{
|
||||
Tags { "RenderType"="TransparentCutout" }
|
||||
LOD 100
|
||||
|
||||
Pass
|
||||
{
|
||||
Tags { "LightMode"="Always" }
|
||||
|
||||
Cull Off
|
||||
ZWrite On
|
||||
AlphaToMask On
|
||||
ColorMask RGB
|
||||
Blend Off
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#pragma multi_compile_fog
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
|
||||
struct appdata
|
||||
{
|
||||
float2 uv : TEXCOORD0;
|
||||
float4 vertex : POSITION;
|
||||
};
|
||||
|
||||
struct v2f
|
||||
{
|
||||
float2 uv : TEXCOORD0;
|
||||
float4 vertex : SV_POSITION;
|
||||
UNITY_FOG_COORDS(1)
|
||||
};
|
||||
|
||||
UNITY_DECLARE_TEX2DARRAY(_TextureArray);
|
||||
float4 _TextureArray_ST;
|
||||
float _Cutoff;
|
||||
fixed4 _Color;
|
||||
|
||||
int _FlipbookFPS;
|
||||
int _FlipbookFrames;
|
||||
|
||||
v2f vert (appdata v)
|
||||
{
|
||||
v2f o;
|
||||
o.vertex = UnityObjectToClipPos(v.vertex);
|
||||
o.uv = TRANSFORM_TEX(v.uv, _TextureArray);
|
||||
UNITY_TRANSFER_FOG(o,o.vertex);
|
||||
return o;
|
||||
}
|
||||
|
||||
fixed4 frag (v2f i) : SV_Target
|
||||
{
|
||||
// Calculate flipbook's UV
|
||||
float frame = fmod(floor(_Time.y * _FlipbookFPS), _FlipbookFrames); // Cyclic frame value
|
||||
float3 uvw = float3(i.uv, frame);
|
||||
|
||||
// Sample current flipbook's texture
|
||||
fixed4 col = UNITY_SAMPLE_TEX2DARRAY(_TextureArray, uvw) * _Color;
|
||||
|
||||
// Clip alpha
|
||||
clip(col.a - _Cutoff);
|
||||
|
||||
// And then apply Unity's fog
|
||||
UNITY_APPLY_FOG(i.fogCoord, col);
|
||||
|
||||
return col;
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user