首页 > 代码库 > Radial Blur
Radial Blur
【Radial Blur】
核心代码如下:
1 v2f vert (appdata_img v) 2 { 3 v2f o; 4 o.pos = mul(UNITY_MATRIX_MVP, v.vertex); 5 o.uv = v.texcoord.xy; 6 return o; 7 } 8 9 float4 frag (v2f i) : COLOR 10 { 11 float2 texCoord = i.uv; 12 float2 dir = 0.5 – texCoord; 13 float dist = length(dir); 14 dir /= dist; 15 float4 color = tex2D(_MainTex, texCoord); 16 float4 sum = color;17 18 float samples[10] = float[](-0.08,-0.05,-0.03,-0.02,-0.01,0.01,0.02,0.03,0.05,0.08);19 20 for (int i = 0; i < 10; ++i) 21 { 22 sum += tex2D(_MainTex, texCoord + dir*samples[i]*fSampleDist); 23 }24 25 sum /= 11.0; 26 float t = saturate(dist * fSampleStrength); 27 return lerp(color, sum, t); 28 }
参考:
1、http://www.gamerendering.com/2008/12/20/radial-blur-filter/
Radial Blur
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。