纳金网

标题: 简单水下效果shader [打印本页]

作者: 晃晃    时间: 2011-9-8 08:13
标题: 简单水下效果shader
在unity3d中实现一个完美的水面下效果还是有很大难度的,下面是一个简单的shader效果,大家可以试试看!代码未经测试!
Shader "Hidden/Wiggle" {
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 {
i.uv.x += sin(_Time.y+i.uv.x*10)*0.01;
i.uv.y += cos(_Time.y+i.uv.y*10)*0.01;
float4 c = tex2D(_MainTex, i.uv);
return c;
}
ENDCG
}
}
Fallback off
}
//====c# code for camera:
using UnityEngine;

[ExecuteInEditMode]
[AddComponentMenu("Image Effects/Wiggle")]
public class Wiggle : ImageEffectBase {

// Called by camera to apply image effect
void OnRenderImage (RenderTexture source, RenderTexture destination) {
Graphics.Blit (source, destination, material);
}
}
作者: Asen    时间: 2011-9-8 09:28

作者: tc    时间: 2012-3-27 23:18
楼主收集的可真全哦

作者: BU Secret    时间: 2012-3-30 17:50
看不懂
作者: 菜刀吻电线    时间: 2012-4-28 23:20
我看看就走,你们聊!

作者: 晃晃    时间: 2012-8-13 09:08
先垫一块,再说鸟

作者: 菜刀吻电线    时间: 2012-10-15 23:23
不会吧,太恐怖了

作者: 奇    时间: 2012-11-8 23:18
无聊时可以刷屏幕 灌水 也可以试试 帖子的标题究竟可以写多长

作者: 菜刀吻电线    时间: 2013-2-19 23:37
谢谢楼主,真是太实用了





欢迎光临 纳金网 (http://go.narkii.com/club/) Powered by Discuz! X2.5