纳金网
标题:
梦幻画面效果shader
[打印本页]
作者:
晃晃
时间:
2011-9-2 08:24
标题:
梦幻画面效果shader
此shader效果未经实际测试,朋友们可以测试下!
Here is shader file (save as Dream.shader in your assets folder):
Shader "Hidden/Dream" {
Properties {
_MainTex ("Base (RGB)", 2D) = "white" {}
}
SubShader {
Pass {
ZTest Always Cull Off ZWrite Off
Fog { Mode off }
CGPROGRAM
#pragma vertex vert_img
#pragma fragment frag
#pragma fragmentoption ARB_precision_hint_fastest
#include "UnityCG.cginc"
uniform sampler2D _MainTex;
float4 frag (v2f_img i) : COLOR {
float4 c = tex2D(_MainTex, i.uv);
c += tex2D(_MainTex, i.uv+0.001);
c += tex2D(_MainTex, i.uv+0.003);
c += tex2D(_MainTex, i.uv+0.005);
c += tex2D(_MainTex, i.uv+0.007);
c += tex2D(_MainTex, i.uv+0.009);
//c += tex2D(_MainTex, i.uv+0.011);
c += tex2D(_MainTex, i.uv-0.001);
c += tex2D(_MainTex, i.uv-0.003);
c += tex2D(_MainTex, i.uv-0.005);
c += tex2D(_MainTex, i.uv-0.007);
c += tex2D(_MainTex, i.uv-0.009);
//c += tex2D(_MainTex, i.uv-0.011);
c.rgb = float3((c.r+c.g+c.b)/3.0);
c = c / 9.5;
return c;
}
ENDCG
}
}
Fallback off
}
here is code to be attached to camera (save as dream.cs):
using UnityEngine;
[ExecuteInEditMode]
[AddComponentMenu("Image Effects/Dream")]
public class Dream : ImageEffectBase {
// Called by camera to apply image effect
void OnRenderImage (RenderTexture source, RenderTexture destination) {
Graphics.Blit (source, destination, material);
}
}
作者:
Asen
时间:
2011-9-2 09:00
作者:
此瑜非彼鱼
时间:
2012-3-2 21:58
灌水。。。
作者:
C.R.CAN
时间:
2012-3-23 23:27
人过留名!
作者:
C.R.CAN
时间:
2012-4-1 23:23
真不错,全存下来了.
作者:
晃晃
时间:
2012-6-11 23:21
路过、路过、快到鸟,列位请继续...ing
作者:
tc
时间:
2012-6-15 23:23
很经典,很实用,学习了!
作者:
晃晃
时间:
2012-7-29 23:23
非常感谢,管理员设置了需要对新回复进行审核,您的帖子通过审核后将被显示出来,现在将转入主题
作者:
晃晃
时间:
2012-8-24 23:27
心中有爱,爱咋咋地
作者:
菜刀吻电线
时间:
2012-8-25 23:29
俺是新人,这厢有礼了!
作者:
tc
时间:
2012-10-7 23:24
很经典,很实用,学习了!
作者:
tc
时间:
2012-10-21 23:35
真不错,全存下来了.
作者:
晃晃
时间:
2012-11-2 23:28
我就看看,我不说话
作者:
tc
时间:
2012-11-7 23:39
很经典,很实用,学习了!
作者:
奇
时间:
2012-12-6 23:18
“再次路过……”我造一个-----特别路过
作者:
奇
时间:
2013-3-13 23:26
先顶上去,偶要高亮加精鸟!
欢迎光临 纳金网 (http://go.narkii.com/club/)
Powered by Discuz! X2.5