纳金网
标题:
Tiling Shader重复效果shader
[打印本页]
作者:
会飞的鱼
时间:
2012-3-9 11:12
标题:
Tiling Shader重复效果shader
Shader "Tiles" {
Properties {
_MainTex ("Base (RGB)", 2D) = "white" {}
_gNumTiles ("Number Of Tiles", Range (1,100)) = 1
_gThreshhold ("Edge Width", Range (0.0,2.0)) = 0.15
_gEdgeColor ("Color", Color) = (.5, .5, .5, 1)
}
SubShader {
Tags { "RenderType"="Opaque" }
LOD 200
CGPROGRAM
#pragma surface surf Lambert
sampler2D _MainTex;
s***ct Input {
float2 uv_MainTex;
};
float _gNumTiles;
float _gThreshhold;
float4 _gEdgeColor;
void surf (Input IN, inout SurfaceOutput o) {
half size = 1.0/_gNumTiles;
half2 Pbase = IN.uv_MainTex - fmod(IN.uv_MainTex,size.xx);
half2 PCenter = Pbase + (size/2.0).xx;
half2 st = (IN.uv_MainTex - Pbase)/size;
half4 c1 = (half4)0;
half4 c2 = (half4)0;
half4 invOff = half4((1-_gEdgeColor.xyz),1);
if (st.x > st.y) { c1 = invOff; }
half threshholdB = 1.0 - _gThreshhold;
if (st.x > threshholdB) { c2 = c1; }
if (st.y > threshholdB) { c2 = c1; }
half4 cBottom = c2;
c1 = (half4)0;
c2 = (half4)0;
if (st.x > st.y) { c1 = invOff; }
if (st.x < _gThreshhold) { c2 = c1; }
if (st.y < _gThreshhold) { c2 = c1; }
half4 cTop = c2;
half4 tileColor = tex2D(_MainTex,PCenter);
half4 result = tileColor + cTop - cBottom;
o.Albedo = result.rgb;
o.Alpha = result.a;
}
ENDCG
}
FallBack "Diffuse"
作者:
BU Secret
时间:
2012-3-9 17:38
这是啥??
作者:
BU Secret
时间:
2012-3-9 17:44
不清楚
作者:
难骑
时间:
2012-3-9 19:50
提示:
作者被禁止或删除 内容自动屏蔽
作者:
浩劫
时间:
2012-3-9 20:03
欢迎光临 纳金网 (http://go.narkii.com/club/)
Powered by Discuz! X2.5