Merge brightness and subpixels passes in custom LCD shader

This commit is contained in:
EddyHg80 2021-12-23 11:09:24 +01:00
parent 5a8830124b
commit 598b9e237b
4 changed files with 15 additions and 28 deletions

View File

@ -1,9 +1,9 @@
varying vec2 texCoord; varying vec2 texCoord;
uniform sampler2D tex; uniform sampler2D tex;
uniform int enable;
uniform float reflectionBrightness; uniform float reflectionBrightness;
uniform vec2 reflectionDistance; uniform vec2 reflectionDistance;
uniform float lightBrightness; uniform float lightBrightness;
uniform int enable;
const float speed = 2.0; const float speed = 2.0;
const float decay = 2.0; const float decay = 2.0;

View File

@ -1,9 +0,0 @@
varying vec2 texCoord;
uniform sampler2D tex;
uniform float brightness;
void main() {
vec4 color = texture2D(tex, texCoord);
color.rgb *= brightness;
gl_FragColor = color;
}

View File

@ -1,6 +1,7 @@
varying vec2 texCoord; varying vec2 texCoord;
uniform sampler2D tex; uniform sampler2D tex;
uniform vec2 texSize; uniform vec2 texSize;
uniform float brightness;
uniform float subPixelDimming; uniform float subPixelDimming;
void main() { void main() {
@ -10,6 +11,7 @@ void main() {
subPixels[0] = vec3(1.0, subPixelDimming, subPixelDimming); subPixels[0] = vec3(1.0, subPixelDimming, subPixelDimming);
subPixels[1] = vec3(subPixelDimming, 1.0, subPixelDimming); subPixels[1] = vec3(subPixelDimming, 1.0, subPixelDimming);
subPixels[2] = vec3(subPixelDimming, subPixelDimming, 1.0); subPixels[2] = vec3(subPixelDimming, subPixelDimming, 1.0);
color.rgb *= brightness;
color.rgb *= subPixels[int(mod(texCoord.s * texSize.x * 3.0, 3.0))]; color.rgb *= subPixels[int(mod(texCoord.s * texSize.x * 3.0, 3.0))];
gl_FragColor = color; gl_FragColor = color;
} }

View File

@ -2,63 +2,57 @@
name=Custom LCD name=Custom LCD
author=endrift, Dominus Iniquitatis, EddyHg80 author=endrift, Dominus Iniquitatis, EddyHg80
description=Configurable LCD emulation. description=Configurable LCD emulation.
passes=4 passes=3
[pass.0] [pass.0]
fragmentShader=customLCD-brightness.fs fragmentShader=customLCD-subPixels.fs
blend=1 blend=1
width=-1 width=-3
height=-1 height=-3
[pass.0.uniform.brightness] [pass.0.uniform.brightness]
type=float type=float
default=1.1 default=1.1
readableName=Brightness readableName=Brightness
[pass.1] [pass.0.uniform.subPixelDimming]
fragmentShader=customLCD-subPixels.fs
blend=1
width=-3
height=-3
[pass.1.uniform.subPixelDimming]
type=float type=float
default=0.2 default=0.2
readableName=Sub pixel dimming readableName=Sub pixel dimming
[pass.2] [pass.1]
fragmentShader=customLCD-pixelBounds.fs fragmentShader=customLCD-pixelBounds.fs
blend=1 blend=1
width=-6 width=-6
height=-6 height=-6
[pass.2.uniform.boundBrightness] [pass.1.uniform.boundBrightness]
type=float type=float
default=0.9 default=0.9
readableName=Pixel bound brightness readableName=Pixel bound brightness
[pass.3] [pass.2]
fragmentShader=ags001-light.fs fragmentShader=ags001-light.fs
blend=1 blend=1
width=-6 width=-6
height=-6 height=-6
[pass.3.uniform.enable] [pass.2.uniform.enable]
type=int type=int
default=0 default=0
readableName=Enable AGS-001's pristine light and reflections readableName=Enable AGS-001's pristine light and reflections
[pass.3.uniform.lightBrightness] [pass.2.uniform.lightBrightness]
type=float type=float
default=0.9 default=0.9
readableName=Light brightness readableName=Light brightness
[pass.3.uniform.reflectionBrightness] [pass.2.uniform.reflectionBrightness]
type=float type=float
default=0.07 default=0.07
readableName=Reflection brightness readableName=Reflection brightness
[pass.3.uniform.reflectionDistance] [pass.2.uniform.reflectionDistance]
type=float2 type=float2
default[0]=0 default[0]=0
default[1]=0.025 default[1]=0.025