From 9eaceeb522c2d19cdc9182967bd13b687b4af1b5 Mon Sep 17 00:00:00 2001 From: Dennis de Vulder Date: Sat, 27 Jun 2026 20:24:38 +0200 Subject: [PATCH] Add water sun reflection toggle --- src/main/java/rs117/hd/HdPlugin.java | 2 ++ src/main/java/rs117/hd/HdPluginConfig.java | 21 +++++++++++++++---- .../resources/rs117/hd/utils/constants.glsl | 1 + src/main/resources/rs117/hd/utils/water.glsl | 7 +++++-- 4 files changed, 25 insertions(+), 6 deletions(-) diff --git a/src/main/java/rs117/hd/HdPlugin.java b/src/main/java/rs117/hd/HdPlugin.java index 3c0a07388f..b0da6306c4 100644 --- a/src/main/java/rs117/hd/HdPlugin.java +++ b/src/main/java/rs117/hd/HdPlugin.java @@ -909,6 +909,7 @@ public ShaderIncludes getShaderIncludes() { .define("APPLY_COLOR_FILTER", configColorFilter != ColorFilter.NONE) .define("MATERIAL_COUNT", MaterialManager.MATERIALS.length) .define("WATER_TYPE_COUNT", waterTypeManager.uboWaterTypes.getCount()) + .define("WATER_SUN_REFLECTION", config.waterSunReflection()) .define("DYNAMIC_LIGHTS", configDynamicLights != DynamicLights.NONE) .define("TILED_LIGHTING", configTiledLighting) .define("TILED_LIGHTING_LAYER_COUNT", configDynamicLights.getTiledLightingLayers()) @@ -1814,6 +1815,7 @@ public void processPendingConfigChanges() { case KEY_PARALLAX_OCCLUSION_MAPPING: case KEY_UI_SCALING_MODE: case KEY_VANILLA_COLOR_BANDING: + case KEY_WATER_SUN_REFLECTION: case KEY_WIND_DISPLACEMENT: case KEY_CHARACTER_DISPLACEMENT: case KEY_WIREFRAME: diff --git a/src/main/java/rs117/hd/HdPluginConfig.java b/src/main/java/rs117/hd/HdPluginConfig.java index 72ea74f9db..93f4614672 100644 --- a/src/main/java/rs117/hd/HdPluginConfig.java +++ b/src/main/java/rs117/hd/HdPluginConfig.java @@ -764,12 +764,25 @@ default boolean underwaterCaustics() return true; } + String KEY_WATER_SUN_REFLECTION = "waterSunReflection"; + @ConfigItem( + keyName = KEY_WATER_SUN_REFLECTION, + name = "Water sun reflection", + description = "Controls the reflective sunlight highlight on water surfaces.", + position = 13, + section = environmentSettings + ) + default boolean waterSunReflection() + { + return true; + } + String KEY_WIND_DISPLACEMENT = "windDisplacement"; @ConfigItem( keyName = KEY_WIND_DISPLACEMENT, name = "Wind displacement", description = "Controls whether things like grass and leaves should be affected by wind.", - position = 13, + position = 14, section = environmentSettings ) default boolean windDisplacement() { @@ -781,7 +794,7 @@ default boolean windDisplacement() { keyName = KEY_CHARACTER_DISPLACEMENT, name = "Character displacement", description = "Let players & NPCs affect things like grass whilst walking around.", - position = 14, + position = 15, section = environmentSettings ) default boolean characterDisplacement() { @@ -793,7 +806,7 @@ default boolean characterDisplacement() { keyName = KEY_HIDE_VANILLA_WATER_EFFECTS, name = "Hide vanilla water ripples", description = "Hide vanilla ripples found around objects floating in the water.", - position = 15, + position = 16, section = environmentSettings ) default boolean hideVanillaWaterEffects() { return true; } @@ -803,7 +816,7 @@ default boolean characterDisplacement() { keyName = KEY_POH_THEME_ENVIRONMENTS, name = "Player-owned house themes", description = "Change the environmental lighting based on the POH style.", - position = 16, + position = 17, section = environmentSettings ) default boolean pohThemeEnvironments() { return true; } diff --git a/src/main/resources/rs117/hd/utils/constants.glsl b/src/main/resources/rs117/hd/utils/constants.glsl index 1ef390944e..b2d1207f07 100644 --- a/src/main/resources/rs117/hd/utils/constants.glsl +++ b/src/main/resources/rs117/hd/utils/constants.glsl @@ -56,6 +56,7 @@ #endif #include VANILLA_COLOR_BANDING +#include WATER_SUN_REFLECTION #include UNDO_VANILLA_SHADING #include LEGACY_GREY_COLORS #include DISABLE_DIRECTIONAL_SHADING diff --git a/src/main/resources/rs117/hd/utils/water.glsl b/src/main/resources/rs117/hd/utils/water.glsl index bfb9a62f53..9fa7158cea 100644 --- a/src/main/resources/rs117/hd/utils/water.glsl +++ b/src/main/resources/rs117/hd/utils/water.glsl @@ -81,8 +81,11 @@ vec4 sampleWater(int waterTypeIndex, vec3 viewDir) { vec3 lightOut = max(lightDotNormals, 0.0) * lightColor; // directional light specular - vec3 lightReflectDir = reflect(-lightDir, normals); - vec3 lightSpecularOut = lightColor * specular(IN.texBlend, viewDir, lightReflectDir, vSpecularGloss, vSpecularStrength); + vec3 lightSpecularOut = vec3(0); + #if WATER_SUN_REFLECTION + vec3 lightReflectDir = reflect(-lightDir, normals); + lightSpecularOut = lightColor * specular(IN.texBlend, viewDir, lightReflectDir, vSpecularGloss, vSpecularStrength); + #endif // point lights vec3 pointLightsOut = vec3(0);