瀏覽代碼

neercs: scanline auto-resize

master
父節點
當前提交
b717b0c1f7
共有 2 個文件被更改,包括 9 次插入5 次删除
  1. +6
    -5
      neercs/video/postfx.lolfx
  2. +3
    -0
      neercs/video/render.cpp

+ 6
- 5
neercs/video/postfx.lolfx 查看文件

@@ -14,6 +14,7 @@ void main()

uniform sampler2D texture;
uniform vec2 screen_size;
uniform vec2 ratio_2d;
uniform float time;
uniform vec2 deform;
uniform vec4 ghost1;
@@ -60,7 +61,7 @@ void main(void)

vec3 c=source+g1*ghost1.w+g2*ghost2.w; // mix

float v=aberration/float(screen_size.x);//+aberration/float(screen_size.x)*(2.0-mask);
float v=aberration/float(screen_size.x/ratio_2d.x);//+aberration/float(screen_size.x)*(2.0-mask);
vec3 ca1=get_color(texture,vec2(z.x-v,z.y));
vec3 ca2=get_color(texture,vec2(z.x+v,z.y));
c+=vec3(ca1.x,c.y,ca2.z); // chromatic aberration
@@ -80,10 +81,10 @@ void main(void)
if(k>r_p&&k<r_p+r_h) r=mix(c3,c4,(k-r_p)*(1/r_h));
if(k>=r_p+r_h) r=mix(c4,c5,k*((k-(r_p+r_h))/(r_p-r_h)));

c*=moire_h.x+moire_h.y*sin(z.y*float(screen_size.y*moire_h.z))*sin(0.5+z.x*float(screen_size.x*moire_h.w)); // moire h
c*=moire_v.x+moire_v.y*sin(z.x*float(screen_size.x*moire_v.z))*sin(0.5+z.y*float(screen_size.y*moire_v.w)); // moire v
c*=scanline_h.x+scanline_h.y*cos(z.y*float(screen_size.y*scanline_h.z+scanline_h.w)); // scanline h
c*=scanline_v.x+scanline_v.y*cos(z.x*float(screen_size.x*scanline_v.z+scanline_v.w)); // scanline v
c*=moire_h.x+moire_h.y*sin(z.y*float(screen_size.y*moire_h.z)/ratio_2d.y)*sin(0.5+z.x*float(screen_size.x*moire_h.w)/ratio_2d.x); // moire h
c*=moire_v.x+moire_v.y*sin(z.x*float(screen_size.x*moire_v.z)/ratio_2d.x)*sin(0.5+z.y*float(screen_size.y*moire_v.w)/ratio_2d.y); // moire v
c*=scanline_h.x+scanline_h.y*cos(z.y*float(screen_size.y*scanline_h.z+scanline_h.w)/ratio_2d.y); // scanline h
c*=scanline_v.x+scanline_v.y*cos(z.x*float(screen_size.x*scanline_v.z+scanline_v.w)/ratio_2d.x); // scanline v
c+=r*0.05; // reflection
c*=mix(1.0,mask,vignetting); // vignetting
c*=letterbox(z,corner.x+2.0,corner.y,corner.z); // corner


+ 3
- 0
neercs/video/render.cpp 查看文件

@@ -494,6 +494,7 @@ ShaderUniform shader_noise_texture,
ShaderUniform shader_postfx_texture,
shader_postfx_texture_2d,
shader_postfx_screen_size,
shader_postfx_ratio_2d,
shader_postfx_time,
shader_postfx_deform,
shader_postfx_ghost1,
@@ -594,6 +595,7 @@ int Render::InitDraw(void)
shader_postfx_texture = shader_postfx->GetUniformLocation("texture");
shader_postfx_texture_2d = shader_postfx->GetUniformLocation("texture_2d");
shader_postfx_screen_size = shader_postfx->GetUniformLocation("screen_size");
shader_postfx_ratio_2d = shader_postfx->GetUniformLocation("ratio_2d");
shader_postfx_time = shader_postfx->GetUniformLocation("time");
shader_postfx_deform = shader_postfx->GetUniformLocation("deform");
shader_postfx_ghost1 = shader_postfx->GetUniformLocation("ghost1");
@@ -1304,6 +1306,7 @@ void Render::Draw3D()
shader_postfx->Bind();
shader_postfx->SetUniform(shader_postfx_texture, fbo_screen->GetTexture(), 0);
shader_postfx->SetUniform(shader_postfx_screen_size, (vec2)screen_size);
shader_postfx->SetUniform(shader_postfx_ratio_2d, (vec2)ratio_2d / 2);
shader_postfx->SetUniform(shader_postfx_time, fx_angle);
shader_postfx->SetUniform(shader_postfx_deform, postfx_deform);
shader_postfx->SetUniform(shader_postfx_ghost1, postfx_ghost1);


Loading…
取消
儲存