- 最后登录
- 2014-10-23
- 注册时间
- 2011-7-19
- 阅读权限
- 90
- 积分
- 81303
- 纳金币
- -1
- 精华
- 11
|
Blush
Glow
The Pro Standard Assets package that comes with Unity has a simple glow effect. Their implementation uses the alpha channel of the destination render texture to decide where to render glow. This limits us a couple ways. We can not have multicolored glow effects and we can not use the alpha channel for anything else. We decided to just bite the bullet and have a separate render texture for rendering glow.
Now we’ve freed up the destination render texture’s alpha channel for something else to use and we can have glow any color we like. Other than the additional memory needed for a 32bit render texture there’s a large disadvantage to doing it our way. Glow is no longer occluded by other geometry. A workaround for this is to have objects that you don’t want to glow render black to the glow render texture. Since glow is an additive pass, anything that is black will do nothing to the original image.
The Glow Replace Shader:
Shader “Blush/Glow Replace” {
SubShader {
Tags { “RenderEffect”=“Glow” }
Pass {
Fog { Mode Off }
Color [_Glow_Color]
}
}
}
For every object we wanted to glow we added two things to the object’s original shader.
- Tag: “RenderEffect” = “Glow”
- Property: _Glow_Color (”Glow Color”, COLOR) = (1,1,1,1)
Distortion
Distortion is handled in a few steps.
1. Render the scene to a render texture.
2. Render a 2 dimensional “normal” map to a render texture.
3. Draw the scene’s render texture to the screen offsetting each texels’ texture coordinate by the amount specified by the 2 dimensional “normal” map texture.
Blush used a constantly oscillating full screen normal map to distort the scene. This distortion helped established an underwater feel. We used replacement shaders to render directly to this normal map to further modify the distortion. The artists used these shaders on particles to provide distortion effects on fast-moving tentacles, enemies, and other places.
The Particle Distortion Replace Shader:
Shader “Squiddy/Post Processing/Distortion Replace” {
Properties {
_BumpMap (“Bump (RGB)”, 2D) = “bump” {}
}
SubShader {
Tags { “RenderEffect”=“Distort” }
Pass {
Lighting Off
ZWrite Off
Blend SrcAlpha OneMinusSrcAlpha
BindChannels {
Bind “Color”, color
Bind “Vertex”, vertex
Bind “Texcoord”, texcoord
}
SetTexture[_BumpMap] {combine texture, texture * primary}
}
}
}
转自Blurst Technology
由 u8 发表
|
|