查看: 1058|回复: 0
打印 上一主题 下一主题

[经验分享] 游戏性和画面特效——创建一个老电影式的画面特效(3)

[复制链接]

100

主题

3

听众

7683

积分

高级设计师

Rank: 6Rank: 6

纳金币
2378
精华
0

最佳新人 活跃会员 热心会员 灌水之王 突出贡献

跳转到指定楼层
楼主
发表于 2015-2-24 00:54:18 |只看该作者 |倒序浏览

// Get teh pixed from the Vignette Texture

fixed4 vignetteTex = tex2D(_VignetteTex, i.uv);


// Process the Scratches UV and pixels

half2 scratchesUV = half2(i.uv.x + (_RandomValue * _SinTime.z * _ScratchesXSpeed),

i.uv.y + (_Time.x * _ScratchesYSpeed));

fixed4 scratchesTex = tex2D(_ScratchesTex, scratchesUV);


// Process the Dust UV and pixels

half2 dustUV = half2(i.uv.x + (_RandomValue * _SinTime.z * _DustXSpeed),

i.uv.y + (_Time.x * _DustYSpeed));

fixed4 dustTex = tex2D(_DustTex, dustUV);


// Get the luminosity values from the render texture using the YIQ values

fixed lum = dot(fixed3(0.299, 0.587, 0.114), renderTex.rgb);


// Add the constant calor to the lum values

fixed4 finalColor = lum + lerp(_SepiaColor, _SepiaColor + fixed4(0.1f, 0.1f, 0.1f, 0.1f), _RandomValue);


// Create a constant white color we can use to adjust opacity of effects

fixed3 constantWhite = fixed3(1, 1, 1);


// Composite together the different layers to create final Screen Effect

finalColor = lerp(finalColor, finalColor * vignetteTex, _VignetteAmount);

finalColor.rgb *= lerp(scratchesTex, constantWhite, _RandomValue);

finalColor.rgb *= lerp(dustTex, constantWhite, (_RandomValue * _SinTime.z));

finalColor = lerp(renderTex, finalColor, _EffectAmount);


return finalColor;

}


ENDCG

}

}

FallBack “Diffuse”

}








保存后返回Unity。我们需要在面板中设置对应的图片和属性,像下面这样:














扩展链接




关于YIQ:


http://en.wikipedia.org/wiki/YIQ



http://www.blackice.com/colorspaceYIQ.htm



http://dcssrv1.oit.uci.edu/~wiedeman/cspace/me/infoyiq.html


分享到: QQ好友和群QQ好友和群 腾讯微博腾讯微博 腾讯朋友腾讯朋友 微信微信
转播转播0 分享淘帖0 收藏收藏0 支持支持0 反对反对0
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

关闭

站长推荐上一条 /1 下一条

手机版|纳金网 ( 闽ICP备08008928号

GMT+8, 2024-5-14 19:25 , Processed in 0.081228 second(s), 28 queries .

Powered by Discuz!-创意设计 X2.5

© 2008-2019 Narkii Inc.

回顶部