当前位置:网站首页>Shader_ Animation sequence frame
Shader_ Animation sequence frame
2022-07-07 15:52:00 【Le_ Sam】
// Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)'
Shader "Zombie/ZombieAnimation"
{
Properties
{
_MainTex("Base(RGB)" ,2D) = ""{}
_Row("Row",Int) = 1
_Column("Column",Int) = 1
_Speed("Speed",Range(0,60)) = 30
}
SubShader
{
tags{"Queue" = "Transparent" "RenderType" = "Transparent" "IgnoreProjector" = "True" "PreviewType" = "Plane" }
Blend SrcAlpha OneMinusSrcAlpha
ColorMask RGB
ZWrite Off
Cull Off
Pass
{
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
struct v2f
{
float4 pos:POSITION;
float2 uv:TEXCOORD0;
};
sampler2D _MainTex;
float4 _MainTex_ST;
int _Row;
int _Column;
float _Speed;
v2f vert(appdata_base v)
{
v2f o;
o.pos = UnityObjectToClipPos(v.vertex);
o.uv = TRANSFORM_TEX(v.texcoord,_MainTex);
return o;
}
half4 frag(v2f IN) :COLOR
{
float2 uv = IN.uv;
float cellX = uv.x / _Column;
float cellY = uv.y / _Row;
//Sprite total
int count = _Row * _Column;
// stay 0 To count-1 Cycle in range
int SpriteIndex = fmod(_Time.w*_Speed,count);
// At present Sprite Subscript of the line
int SpriteRowIndx = (SpriteIndex / _Column);
// At present Sprite Subscript of the column
int SpriteColumnIndex = fmod(SpriteIndex,_Column);
// because uv The lower left corner of the coordinate is (0,0), The first line is the bottom line , In order to conform to our common sense , We switch to the first line of the top line ,eg:0,1,2-->2,1,0
SpriteRowIndx = (_Row - 1) - fmod(SpriteRowIndx,_Row);
// multiply 1.0 Convert to floating point number
uv.x = cellX + SpriteColumnIndex * 1.0 / _Column;
uv.y = cellY + SpriteRowIndx * 1.0 / _Row;
half4 c = tex2D(_MainTex,uv);
return c;
}
ENDCG
}
}
FallBack "Diffuse"
}
边栏推荐
- Numpy --- basic learning notes
- The "go to definition" in VS2010 does not respond or prompts the solution of "symbol not found"
- AE learning 02: timeline
- [original] all management without assessment is nonsense!
- Monthly observation of internet medical field in May 2022
- [quick start of Digital IC Verification] 23. AHB sramc of SystemVerilog project practice (3) (basic points of AHB protocol)
- Steps to create P8 certificate and warehousing account
- Ue4/ue5 multi thread development attachment plug-in download address
- How does geojson data merge the boundaries of regions?
- 【数字IC验证快速入门】20、SystemVerilog学习之基本语法7(覆盖率驱动...内含实践练习)
猜你喜欢

【数字IC验证快速入门】20、SystemVerilog学习之基本语法7(覆盖率驱动...内含实践练习)

numpy--数据清洗

强化实时数据管理,英方软件助力医保平台安全建设

Create lib Library in keil and use lib Library

深度之眼(七)——矩阵的初等变换(附:数模一些模型的解释)

Apache Doris刚“毕业”:为什么应关注这种SQL数据仓库?

Zhongang Mining: Fluorite continues to lead the growth of new energy market

numpy--疫情数据分析案例
![[quick start of Digital IC Verification] 23. AHB sramc of SystemVerilog project practice (3) (basic points of AHB protocol)](/img/e9/9e32e38e12e1fa71732c52b8ee0ab0.png)
[quick start of Digital IC Verification] 23. AHB sramc of SystemVerilog project practice (3) (basic points of AHB protocol)

Three. JS introductory learning notes 10:three JS grid
随机推荐
postman生成时间戳,未来时间戳
[wechat applet] Chapter (5): basic API interface of wechat applet
Three. JS introductory learning notes 10:three JS grid
./ Functions of configure, make and make install
如何在shell中实现 backspace
Whole process analysis of unity3d rendering pipeline
Learn good-looking custom scroll bars in 1 minute
无线传感器网络--ZigBee和6LoWPAN
Super signature principle (fully automated super signature) [Yun Xiaoduo]
Numpy --- basic learning notes
航运船公司人工智能AI产品成熟化标准化规模应用,全球港航人工智能/集装箱人工智能领军者CIMC中集飞瞳,打造国际航运智能化标杆
The "go to definition" in VS2010 does not respond or prompts the solution of "symbol not found"
Webcodecs parameter settings -avc1.42e01e meaning
When opening the system window under UE4 shipping, the problem of crash is attached with the plug-in download address
numpy--数据清洗
SPI master rx time out中断
Three. JS introductory learning notes 00: coordinate system, camera (temporarily understood)
Align individual elements to the right under flex layout
C4D learning notes 2- animation - timeline and time function
Getting started with webgl (3)