Skip to content

Commit 6deee67

Browse files
author
Jim Pavan
committed
AMD support + fixed flickering artifacts
1 parent f0d9346 commit 6deee67

File tree

7 files changed

+30
-14
lines changed

7 files changed

+30
-14
lines changed

shaders/composite.fsh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ void getSurfaceEffect(in vec4 stencil, inout vec4 reflectionColor, inout vec4 wa
186186
}
187187

188188
color = vec4(color.rgb, 1.0) + vec4(reflectionColor.rgb, 1.0);
189-
waterRawColor = mix(color, waterRawColor, 0.60);
189+
waterRawColor = mix(color, waterRawColor, 0.50);
190190
}
191191

192192
vec4 computeFinalWaterColor(vec4 stencil, vec4 color, float fadeAmount, bool glass, float glassAlpha, vec4 waterRawColor) {

shaders/composite_a.csh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,11 @@ void main() {
5151
Sort by order occurence number, so big water patches are reflected first (next frame)
5252
This leads to potentially omitting some water patches if too many planes, but the ones discarded are the smallest on screen
5353
*/
54-
int heights[PLANES] = int[PLANES](lowerWorldBound - 1);
55-
int occurences[PLANES] = int[PLANES](0);
54+
int heights[PLANES];
55+
for (int i = 0; i < PLANES; ++i) heights[i] = lowerWorldBound - 1;
56+
57+
int occurences[PLANES];
58+
for (int i = 0; i < PLANES; ++i) occurences[i] = 0;
5659

5760
findBiggestWaterPatches(heights, occurences);
5861
layersData.waterHeights = heights;

shaders/gbuffers_skytextured.fsh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ void main() {
2929
}
3030

3131
if (mode == 1) {
32-
removeHalo(texturedColor);
32+
// removeHalo(texturedColor);
3333

3434
if (renderStage == MC_RENDER_STAGE_SUN || renderStage == MC_RENDER_STAGE_MOON) {
3535
// Sun & moon fragments

shaders/gbuffers_terrain.fsh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ void main() {
3838
color = applyFog(color, 1.0, false);
3939

4040
// Terrain lighting (for darker water in deeper areas)
41-
terrainLightMapForWater = clamp(pow(texture(lightmap, lmcoord), vec4(1.0)), 0.0, 1.0);
41+
terrainLightMapForWater = texture(lightmap, lmcoord);
4242
terrainLightMapForWater *= getVanillaLighting(n);
4343

4444
// Terrain mask

shaders/lang/en_US.lang

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,23 @@
11
option.INFO=Water Shader Alpha
2-
value.INFO.0=v1.3
2+
value.INFO.0=v1.4
33

44
option.STYLE=Water surface style
55
value.STYLE.1=§bNecrowizzard
66
value.STYLE.2=§bSuperbomb17
77

88
option.PLANES=Available simultaneous water levels
9+
option.PLANES.comment=Number of water patches at different heights handled for reflections.
910
value.PLANES.1=§a 1 - Low
1011
value.PLANES.2=§e 2 - Medium
1112
value.PLANES.3=§c 3 - High
1213
value.PLANES.4=§4 4 - Extreme
13-
option.PLANES.comment=Number of water patches at different heights handled for reflections.
1414

1515
option.SKYTEXTURED=Sun & moon reflection (§cExperimental)
1616
value.SKYTEXTURED.0=§cOFF
17-
value.SKYTEXTURED.1=§aON
17+
value.SKYTEXTURED.1=§aON
18+
19+
option.REFLECTION_RESOLUTION=Resolution of reflection texture (solves flickering artifacts).
20+
option.REFLECTION_RESOLUTION.comment=Resolution of the shadowmap for reflections can be too small for your screen. Increase the size if you see flickering issues on reflections.
21+
value.REFLECTION_RESOLUTION.1=§a 1024 - Low
22+
value.REFLECTION_RESOLUTION.2=§e 2048 - Medium
23+
value.REFLECTION_RESOLUTION.3=§c 4096 - High

shaders/lib/common.glsl

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,6 @@ uniform mat4 shadowModelViewInverse;
6666
// Settings for transitioning between bright and dark environments
6767
const float eyeBrightnessHalflife = 15.0f;
6868

69-
// Settings for shadow pass
70-
const int shadowMapResolution = 2048;
71-
const float shadowIntervalSize = 0.0f;
72-
7369
// Texture targets clear settings
7470
const bool colortex8Clear = false;
7571
const vec4 shadowcolor0ClearColor = vec4(0.0, 0.0, 0.0, 1.0);
@@ -99,7 +95,7 @@ const vec4 necrowizzardUnderwaterFogColorDay = vec4(0.03, 0.05, 0.12, 0.99);
9995
const vec4 superbomb17UnderwaterFogColorDay = vec4(0.03, 0.05, 0.12, 0.99); // Superbomb17 fog color when underwater (daytime)
10096
const vec4 underwaterFogColorNight = vec4(0.02, 0.13, 0.24, 0.9); // Fog color when underwater (nighttime)
10197
const float waterSurfaceTransparency = 0.35; // Water surface/texture transparency
102-
const float waterBlendFactor = 0.30; // How much to blend flowing water to scene
98+
const float waterBlendFactor = 0.40; // How much to blend flowing water to scene
10399
const float waterClipPlane = 1.0; // Delete vertices too close from water surface
104100
const float eyeCameraOffset = 1.68; // Eye camera offset from player's feet
105101
const float waterBlockOffset = 1.005; // Water block clipping plane height (inside block)
@@ -117,6 +113,17 @@ uniform vec2 iresolution;
117113
#define STYLE 1 // Water surface style [1 2]
118114
#define PLANES 1 // Reflection planes allowed [1 2 3 4]
119115
#define SKYTEXTURED 0 // Sun & moon reflection [0 1]
116+
#define REFLECTION_RESOLUTION 2 // Shadow map texture resolution [1 2 3]
117+
118+
// Settings for shadow pass
119+
#if REFLECTION_RESOLUTION == 1
120+
const int shadowMapResolution = 1024;
121+
#elif REFLECTION_RESOLUTION == 2
122+
const int shadowMapResolution = 2048;
123+
#else
124+
const int shadowMapResolution = 4096;
125+
#endif
126+
const float shadowIntervalSize = 0.0f;
120127

121128
// Shader Storage Buffer Object for water information in player view
122129
layout(std430, binding = 0) buffer SSBOWaterShader {

shaders/shaders.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ bufferObject.0=1556
66
bufferObject.1=4 true 1.0 1.0
77

88
# Shader options
9-
screen=INFO STYLE PLANES SKYTEXTURED
9+
screen=INFO STYLE PLANES SKYTEXTURED REFLECTION_RESOLUTION
1010
sliders=PLANES
1111
screen.columns=1
1212

0 commit comments

Comments
 (0)