mirror of https://github.com/mgba-emu/mgba.git
Shaders: Add uniforms to AGS-001
This commit is contained in:
parent
ac9c247695
commit
b3d08eceb1
|
@ -1,14 +1,27 @@
|
|||
varying vec2 texCoord;
|
||||
uniform sampler2D tex;
|
||||
uniform float reflectionBrightness;
|
||||
uniform vec2 reflectionDistance;
|
||||
uniform float lightBrightness;
|
||||
|
||||
const float speed = 2.0;
|
||||
const float decay = 2.0;
|
||||
const float coeff = 2.5;
|
||||
|
||||
void main() {
|
||||
vec4 color = texture2D(tex, texCoord);
|
||||
vec4 reflection = texture2D(tex, texCoord - vec2(0, 0.025));
|
||||
float sp = pow(speed, lightBrightness);
|
||||
float dc = pow(decay, -lightBrightness);
|
||||
float s = (sp - dc) / (sp + dc);
|
||||
vec2 radius = (texCoord.st - vec2(0.5, 0.5)) * vec2(coeff * s);
|
||||
radius = pow(radius, vec2(4.0));
|
||||
vec3 bleed = vec3(0.12, 0.14, 0.19);
|
||||
vec2 radius = (texCoord.st - vec2(0.5, 0.5)) * vec2(1.6, 1.6);
|
||||
bleed += (dot(pow(radius, vec2(4.0)), pow(radius, vec2(4.0))) + vec3(0.02, 0.03, 0.05)) * vec3(0.14, 0.18, 0.2);
|
||||
color.rgb += bleed;
|
||||
color.rgb += reflection.rgb * 0.07;
|
||||
bleed += (dot(radius, radius) + vec3(0.02, 0.03, 0.05)) * vec3(0.14, 0.18, 0.2);
|
||||
|
||||
vec4 color = texture2D(tex, texCoord);
|
||||
color.rgb += pow(bleed, pow(vec3(lightBrightness), vec3(-0.5)));
|
||||
|
||||
vec4 reflection = texture2D(tex, texCoord - reflectionDistance);
|
||||
color.rgb += reflection.rgb * reflectionBrightness;
|
||||
color.a = 1.0;
|
||||
gl_FragColor = color;
|
||||
}
|
||||
|
|
|
@ -14,3 +14,16 @@ height=640
|
|||
fragmentShader=ags001-light.fs
|
||||
width=960
|
||||
height=640
|
||||
|
||||
[uniform.lightBrightness]
|
||||
type=float
|
||||
default=1
|
||||
|
||||
[uniform.reflectionBrightness]
|
||||
type=float
|
||||
default=0.07
|
||||
|
||||
[uniform.reflectionDistance]
|
||||
type=float2
|
||||
default[0]=0
|
||||
default[1]=0.025
|
||||
|
|
Loading…
Reference in New Issue