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

shader效果-梦幻

[复制链接]

5552

主题

2

听众

8万

积分

首席设计师

Rank: 8Rank: 8

纳金币
-1
精华
11

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

跳转到指定楼层
楼主
发表于 2012-6-26 15:06:25 |只看该作者 |倒序浏览
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);
}
}
You will need the imageeffectbase.cs file from the imageeffects package

原文:http://f***m.unity3d.com/threads ... f308ed98725b9194e92
分享到: QQ好友和群QQ好友和群 腾讯微博腾讯微博 腾讯朋友腾讯朋友 微信微信
转播转播0 分享淘帖0 收藏收藏0 支持支持0 反对反对0
回复

使用道具 举报

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

手机版|纳金网 ( 闽ICP备2021016425号-2/3

GMT+8, 2025-7-19 10:22 , Processed in 0.066093 second(s), 29 queries .

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

© 2008-2019 Narkii Inc.

回顶部