- 精华
- 0
- 帖子
- 69
- 威望
- 0 点
- 积分
- 74 点
- 种子
- 0 点
- 注册时间
- 2009-8-23
- 最后登录
- 2012-6-5
|
发表于 2010-10-14 09:34 · 重庆
|
显示全部楼层
本帖最后由 mgzzzz 于 2011-4-28 15:18 编辑
ogl2的phosphor2x:
=============================================================
uniform sampler2D OGL2Texture;
uniform vec4 OGL2Size;
uniform vec4 OGL2Param;
vec2 rubyTextureSize = OGL2Size.xy;
vec2 rubyOutputSize = OGL2Size.zw;
vec2 rubyInputSize = rubyOutputSize/(1+OGL2Param.z);
#define TEX2D(c) texture2D(OGL2Texture,(c))
#define PI 3.141592653589
#define phase 0.0
#define gamma 2.5
void main()
{
vec2 xy = gl_TexCoord[0].xy;
vec2 one = 1.0/rubyTextureSize;
xy = xy + vec2(0.0 , -0.5 * (phase + (1-phase) * rubyInputSize.y/rubyOutputSize.y) * one.y);
vec2 uv_ratio = fract(xy*rubyTextureSize);
vec4 col, col2;
vec4 coeffs = vec4(1.0 + uv_ratio.x, uv_ratio.x, 1.0 - uv_ratio.x, 2.0 - uv_ratio.x);
coeffs = (sin(PI * coeffs) * sin(PI * coeffs / 2.0)) / (coeffs * coeffs);
coeffs = coeffs / (coeffs.x+coeffs.y+coeffs.z+coeffs.w);
col = clamp(coeffs.x * TEX2D(xy + vec2(-one.x,0.0)) + coeffs.y * TEX2D(xy) + coeffs.z * TEX2D(xy + vec2(one.x, 0.0)) + coeffs.w * TEX2D(xy + vec2(2 * one.x, 0.0)),0.0,1.0);
col2 = clamp(coeffs.x * TEX2D(xy + vec2(-one.x,one.y)) + coeffs.y * TEX2D(xy + vec2(0.0, one.y)) + coeffs.z * TEX2D(xy + one) + coeffs.w * TEX2D(xy + vec2(2 * one.x, one.y)),0.0,1.0);
col = pow(col, gamma);
col2 = pow(col2, gamma);
vec4 wid = 0.2 + 0.4 * pow(col, 2.0);
vec4 weights = uv_ratio.y/wid;
weights = 0.51*exp(-weights*weights)/wid;
wid = 0.2 + 0.4 * pow(col2,2.0);
vec4 weights2 = (1.0-uv_ratio.y)/wid;
weights2 = 0.51*exp(-weights2*weights2)/wid;
gl_FragColor = pow(col * weights + col2 * weights2, 1.0/2.2);
}
=============================================================
个人感觉效果不是很好
注意视频设置里面stretching mode(拉伸模式)不能用默认第一项:拉伸至整个窗口,
否则会有显眼的难看暗纹,
最好选最后一项:保持像素比
而且ogl2插件没提供类似rubyInputSize的原始分辨率变量,
只能以显示分辨率除以整数来模拟,
通过着色器等级调节
总感觉画面怪怪的 |
|