欧美大屁股bbbbxxxx,狼人大香伊蕉国产www亚洲,男ji大巴进入女人的视频小说,男人把ji大巴放进女人免费视频,免费情侣作爱视频

歡迎來到入門教程網(wǎng)!

C#教程

當(dāng)前位置:主頁 > 軟件編程 > C#教程 >

Untiy Shader實現(xiàn)紋理貼圖滾動

來源:本站原創(chuàng)|時間:2020-01-10|欄目:C#教程|點擊: 次

滾動紋理,可以實現(xiàn)一些如瀑布,河流,熔巖流等效果,本質(zhì)上就是UV坐標(biāo)的偏移,在Unity中新建一個Shader,然后修改成下面代碼的樣子,新建一個材質(zhì),選擇此shader,賦予一張貼圖,然后將材質(zhì)應(yīng)用于一個mesh上,運(yùn)行即可看到效果

Shader "Custom/UVOffset" {
 Properties {
  _MainTint("Diffuse Tine",Color) = (1,1,1,1)
  _MainTex("Base (RGB)",2D) = "white"{}
  _ScrollXSpeed("X Scroll Speed",Range(0,10)) = 0
  _ScrollYSpeed("Y Scroll Speed",Range(0,10)) = 2
 }
 SubShader {
  Tags { "RenderType"="Opaque" }
  LOD 200

  CGPROGRAM
  // Physically based Standard lighting model, and enable shadows on all light types
  #pragma surface surf Standard fullforwardshadows

  // Use shader model 3.0 target, to get nicer looking lighting
  #pragma target 3.0

  // 定義 Properties 中的屬性
  fixed4 _MainTint;
  fixed _ScrollXSpeed;
  fixed _ScrollYSpeed;
  sampler2D _MainTex;

  struct Input {
   float2 uv_MainTex;
  };

  void surf (Input IN, inout SurfaceOutputStandard o) {
   fixed2 scrolledUV = IN.uv_MainTex;
   fixed xScrollValue = _ScrollXSpeed * _Time;
   fixed yScrollValue = _ScrollYSpeed * _Time;
   scrolledUV += fixed2(xScrollValue,yScrollValue);

   // 對貼圖進(jìn)行采樣輸出
   half4 c = tex2D(_MainTex,scrolledUV);
   o.Albedo = c.rgb * _MainTint;
   o.Alpha = c.a;
  }
  ENDCG
 } 
 FallBack "Diffuse"
}

以上就是本文的全部內(nèi)容,希望對大家的學(xué)習(xí)有所幫助,也希望大家多多支持我們。

上一篇:Unity常用命令模式詳解

欄    目:C#教程

下一篇:UnityShader3實現(xiàn)波浪效果

本文標(biāo)題:Untiy Shader實現(xiàn)紋理貼圖滾動

本文地址:http://mengdiqiu.com.cn/a1/C_jiaocheng/4837.html

網(wǎng)頁制作CMS教程網(wǎng)絡(luò)編程軟件編程腳本語言數(shù)據(jù)庫服務(wù)器

如果侵犯了您的權(quán)利,請與我們聯(lián)系,我們將在24小時內(nèi)進(jìn)行處理、任何非本站因素導(dǎo)致的法律后果,本站均不負(fù)任何責(zé)任。

聯(lián)系QQ:835971066 | 郵箱:835971066#qq.com(#換成@)

Copyright © 2002-2020 腳本教程網(wǎng) 版權(quán)所有