tr1/output: fix sprites missing fog effect

This commit is contained in:
Marcin Kurczewski 2025-04-07 22:58:52 +02:00
parent def5d37192
commit 67354e9f43
2 changed files with 9 additions and 2 deletions

View file

@ -12,12 +12,14 @@ layout(location = 1) in vec2 inDisplacement;
layout(location = 2) in int inUVWIdx; layout(location = 2) in int inUVWIdx;
layout(location = 3) in float inShade; layout(location = 3) in float inShade;
out vec4 gWorldPos;
out vec2 gTexUV; out vec2 gTexUV;
flat out int gTexLayer; flat out int gTexLayer;
out float gShade; out float gShade;
void main(void) { void main(void) {
vec4 centerEyeSpace = uMatModelView * vec4(inPosition, 1.0); vec4 centerEyeSpace = uMatModelView * vec4(inPosition, 1.0);
gWorldPos = centerEyeSpace;
centerEyeSpace.xy += inDisplacement; centerEyeSpace.xy += inDisplacement;
gl_Position = uMatProjection * centerEyeSpace; gl_Position = uMatProjection * centerEyeSpace;
@ -39,7 +41,9 @@ uniform sampler2D uTexEnvMap;
uniform bool uSmoothingEnabled; uniform bool uSmoothingEnabled;
uniform float uBrightnessMultiplier; uniform float uBrightnessMultiplier;
uniform vec3 uGlobalTint; uniform vec3 uGlobalTint;
uniform vec2 uFog; // x = fog start, y = fog end
in vec4 gWorldPos;
in vec2 gTexUV; in vec2 gTexUV;
flat in int gTexLayer; flat in int gTexLayer;
in float gShade; in float gShade;
@ -56,9 +60,11 @@ void main(void) {
discard; discard;
} }
texColor.rgb *= 2.0 - (gShade / NEUTRAL_SHADE); float shade = gShade;
texColor.rgb *= uBrightnessMultiplier; shade = shadeFog(shade, gWorldPos.z, uFog);
texColor.rgb = applyShade(texColor.rgb, shade);
texColor.rgb *= uGlobalTint; texColor.rgb *= uGlobalTint;
texColor.rgb *= uBrightnessMultiplier;
outColor = vec4(texColor.rgb, 1.0); outColor = vec4(texColor.rgb, 1.0);
} }
#endif #endif

View file

@ -12,6 +12,7 @@
- fixed being stuck on the Restart Level page if using save crystals and F5 is pressed when no saves are present (#2700, regression from 4.8.2) - fixed being stuck on the Restart Level page if using save crystals and F5 is pressed when no saves are present (#2700, regression from 4.8.2)
- fixed being stuck on the Exit to Title page if using save crystals and a new save is made when there were previously none, and then F5 is pressed (#2700, regression from 4.9) - fixed being stuck on the Exit to Title page if using save crystals and a new save is made when there were previously none, and then F5 is pressed (#2700, regression from 4.9)
- fixed the sprite UVs to restore the right and bottom edge pixels (#2672, regression from 4.8) - fixed the sprite UVs to restore the right and bottom edge pixels (#2672, regression from 4.8)
- fixed sprites missing the fog effect (regression from 4.9)
- improved bubble appearance (#2672) - improved bubble appearance (#2672)
- improved rendering performance - improved rendering performance
- removed the pretty pixels options (it's now always enabled, #2258) - removed the pretty pixels options (it's now always enabled, #2258)