欧美一区二区三区老妇人-欧美做爰猛烈大尺度电-99久久夜色精品国产亚洲a-亚洲福利视频一区二区

UnityShader中怎么實(shí)現(xiàn)一個(gè)百葉窗效果-創(chuàng)新互聯(lián)

UnityShader中怎么實(shí)現(xiàn)一個(gè)百葉窗效果,針對這個(gè)問題,這篇文章詳細(xì)介紹了相對應(yīng)的分析和解答,希望可以幫助更多想解決這個(gè)問題的小伙伴找到更簡單易行的方法。

成都創(chuàng)新互聯(lián)IDC提供業(yè)務(wù):四川移動(dòng)機(jī)房托管,成都服務(wù)器租用,四川移動(dòng)機(jī)房托管,重慶服務(wù)器租用等四川省內(nèi)主機(jī)托管與主機(jī)租用業(yè)務(wù);數(shù)據(jù)中心含:雙線機(jī)房,BGP機(jī)房,電信機(jī)房,移動(dòng)機(jī)房,聯(lián)通機(jī)房。

Shader "Unlit/NewUnlitShader"{ Properties { _MainTex ("Texture", 2D) = "white" {} _MainTex2 ("Texture2", 2D) = "white" {} _StartFlag("開始標(biāo)記", float) = 0 _SpeedFactor("速度",Range(0.01,10)) = 0.1 _StartTime("時(shí)間初始標(biāo)記,不要手動(dòng)設(shè)置",float) = 1 _Column("百葉窗的列數(shù)",float ) = 5 } SubShader { Tags { "RenderType"="Opaque" } LOD 100  Pass { CGPROGRAM #pragma vertex vert #pragma fragment frag // make fog work #pragma multi_compile_fog  #include "UnityCG.cginc"  struct appdata { float4 vertex : POSITION; float2 uv : TEXCOORD0; };  struct v2f { float2 uv : TEXCOORD0; float4 vertex : SV_POSITION; };  sampler2D _MainTex; float4 _MainTex_ST;  sampler2D _MainTex2; float4 _MainTex2_ST;  float _StartFlag; float _Column; float _SpeedFactor; float _StartTime;  v2f vert (appdata v) { v2f o; o.vertex = UnityObjectToClipPos(v.vertex); o.uv = TRANSFORM_TEX(v.uv, _MainTex); return o; }  fixed4 frag (v2f i) : SV_Target { fixed4 col = 0; //_StartFlag 通過C#監(jiān)聽鍵盤事件,設(shè)置為1,作為開始動(dòng)畫的標(biāo)記 //step(a,b) => if(b>=a) return 1 else return 0 //i.uv.x % (1/_Column) i.uv.x范圍是0-1,分成_Column份 每份(1/_Column) fixed result = _StartFlag * step( i.uv.x % (1/_Column) ,(_Time.y - _StartTime) * _SpeedFactor );  if( result == 0 ) { col = tex2D(_MainTex, i.uv); } else { col = tex2D(_MainTex2, i.uv); }  return col; } ENDCG } }}

C#控制開關(guān),點(diǎn)擊鍵盤任意按鍵。掛到panel上

using System.Collections;using System.Collections.Generic;using UnityEngine; public class baiyechuang : MonoBehaviour {  // Use this for initialization Material mat; MeshRenderer meshRen; void Start () { meshRen = this.GetComponent<MeshRenderer> (); print (meshRen); mat = meshRen.material; print (mat); }  void OnGUI() { if (Input.anyKeyDown) {  Event e = Event.current;  if (e.isMouse) {  Debug.Log(e.button);  }  if (e.isKey)  {  if (e.keyCode == KeyCode.None)   return;  Debug.Log(e.keyCode); mat.SetFloat ("_StartTime", Time.timeSinceLevelLoad); mat.SetFloat ("_StartFlag", 1);  } } }  }

關(guān)于UnityShader中怎么實(shí)現(xiàn)一個(gè)百葉窗效果問題的解答就分享到這里了,希望以上內(nèi)容可以對大家有一定的幫助,如果你還有很多疑惑沒有解開,可以關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道了解更多相關(guān)知識。

標(biāo)題名稱:UnityShader中怎么實(shí)現(xiàn)一個(gè)百葉窗效果-創(chuàng)新互聯(lián)
分享路徑:http://www.chinadenli.net/article22/dpidcc.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供關(guān)鍵詞優(yōu)化全網(wǎng)營銷推廣App開發(fā)網(wǎng)站排名用戶體驗(yàn)外貿(mào)建站

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)

外貿(mào)網(wǎng)站建設(shè)