diff --git a/api/src/main/java/com/seibel/distanthorizons/api/interfaces/config/client/IDhApiAmbientOcclusionConfig.java b/api/src/main/java/com/seibel/distanthorizons/api/interfaces/config/client/IDhApiAmbientOcclusionConfig.java index 670b7ff8f..5cb2009e7 100644 --- a/api/src/main/java/com/seibel/distanthorizons/api/interfaces/config/client/IDhApiAmbientOcclusionConfig.java +++ b/api/src/main/java/com/seibel/distanthorizons/api/interfaces/config/client/IDhApiAmbientOcclusionConfig.java @@ -23,10 +23,10 @@ import com.seibel.distanthorizons.api.interfaces.config.IDhApiConfigGroup; import com.seibel.distanthorizons.api.interfaces.config.IDhApiConfigValue; /** - * Distant Horizons' fog configuration.

+ * Distant Horizons' SSAO configuration.

* * @author James Seibel - * @version 2022-9-6 + * @version 2026-02-05 * @since API 1.0.0 */ public interface IDhApiAmbientOcclusionConfig extends IDhApiConfigGroup @@ -34,32 +34,4 @@ public interface IDhApiAmbientOcclusionConfig extends IDhApiConfigGroup /** Determines if Ambient Occlusion is rendered */ IDhApiConfigValue enabled(); - /** - * Determines how many points in space are sampled for the occlusion test. - * Higher numbers will improve quality and reduce banding, but will increase GPU load. - */ - IDhApiConfigValue sampleCount(); - - /** Determines the radius Screen Space Ambient Occlusion is applied, measured in blocks. */ - IDhApiConfigValue radius(); - - /** Determines how dark the Screen Space Ambient Occlusion effect will be. */ - IDhApiConfigValue strength(); - - /** Increasing the value can reduce banding at the cost of reducing the strength of the effect. */ - IDhApiConfigValue bias(); - - /** - * Determines how dark the occlusion shadows can be.
- * 0 = totally black at the corners
- * 1 = no shadow - */ - IDhApiConfigValue minLight(); - - /** - * The radius, measured in pixels, that blurring is calculated.
- * Higher numbers will reduce banding at the cost of GPU performance. - */ - IDhApiConfigValue blurRadius(); - } diff --git a/api/src/main/java/com/seibel/distanthorizons/coreapi/ModInfo.java b/api/src/main/java/com/seibel/distanthorizons/coreapi/ModInfo.java index 352bd2b96..e65dac95f 100644 --- a/api/src/main/java/com/seibel/distanthorizons/coreapi/ModInfo.java +++ b/api/src/main/java/com/seibel/distanthorizons/coreapi/ModInfo.java @@ -50,7 +50,7 @@ public final class ModInfo public static final int API_PATCH_VERSION = 0; /** If the config file has an older version it'll be re-created from scratch. */ - public static final int CONFIG_FILE_VERSION = 3; + public static final int CONFIG_FILE_VERSION = 4; /** All DH owned threads should start with this string to allow for easier debugging and profiling. */ public static final String THREAD_NAME_PREFIX = "DH-"; diff --git a/core/src/main/java/com/seibel/distanthorizons/core/api/external/methods/config/client/DhApiAmbientOcclusionConfig.java b/core/src/main/java/com/seibel/distanthorizons/core/api/external/methods/config/client/DhApiAmbientOcclusionConfig.java index d7045b324..f6e68682e 100644 --- a/core/src/main/java/com/seibel/distanthorizons/core/api/external/methods/config/client/DhApiAmbientOcclusionConfig.java +++ b/core/src/main/java/com/seibel/distanthorizons/core/api/external/methods/config/client/DhApiAmbientOcclusionConfig.java @@ -37,28 +37,4 @@ public class DhApiAmbientOcclusionConfig implements IDhApiAmbientOcclusionConfig public IDhApiConfigValue enabled() { return new DhApiConfigValue(Config.Client.Advanced.Graphics.Ssao.enableSsao); } - @Override - public IDhApiConfigValue sampleCount() - { return new DhApiConfigValue(Config.Client.Advanced.Graphics.Ssao.sampleCount); } - - @Override - public IDhApiConfigValue radius() - { return new DhApiConfigValue(Config.Client.Advanced.Graphics.Ssao.radius); } - - @Override - public IDhApiConfigValue strength() - { return new DhApiConfigValue(Config.Client.Advanced.Graphics.Ssao.strength); } - - @Override - public IDhApiConfigValue bias() - { return new DhApiConfigValue(Config.Client.Advanced.Graphics.Ssao.bias); } - - @Override - public IDhApiConfigValue minLight() - { return new DhApiConfigValue(Config.Client.Advanced.Graphics.Ssao.minLight); } - - @Override - public IDhApiConfigValue blurRadius() - { return new DhApiConfigValue(Config.Client.Advanced.Graphics.Ssao.blurRadius); } - } diff --git a/core/src/main/java/com/seibel/distanthorizons/core/config/Config.java b/core/src/main/java/com/seibel/distanthorizons/core/config/Config.java index c64efc245..e6f6572f0 100644 --- a/core/src/main/java/com/seibel/distanthorizons/core/config/Config.java +++ b/core/src/main/java/com/seibel/distanthorizons/core/config/Config.java @@ -367,60 +367,6 @@ public class Config .comment("Enable Screen Space Ambient Occlusion") .build(); - public static ConfigEntry sampleCount = new ConfigEntry.Builder() - .set(6) - .comment("" + - "Determines how many points in space are sampled for the occlusion test. \n" + - "Higher numbers will improve quality and reduce banding, but will increase GPU load." + - "") - .build(); - - public static ConfigEntry radius = new ConfigEntry.Builder() - .set(4.0) - .comment("" + - "Determines the radius Screen Space Ambient Occlusion is applied, measured in blocks." + - "") - .build(); - - public static ConfigEntry strength = new ConfigEntry.Builder() - .set(0.2) - .comment("" + - "Determines how dark the Screen Space Ambient Occlusion effect will be." + - "") - .build(); - - public static ConfigEntry bias = new ConfigEntry.Builder() - .set(0.02) - .comment("" + - "Increasing the value can reduce banding at the cost of reducing the strength of the effect." + - "") - .build(); - - public static ConfigEntry minLight = new ConfigEntry.Builder() - .set(0.25) - .comment("" + - "Determines how dark the occlusion shadows can be. \n" + - "0 = totally black at the corners \n" + - "1 = no shadow" + - "") - .build(); - - public static ConfigEntry blurRadius = new ConfigEntry.Builder() - .set(2) - .comment("" + - "The radius, measured in pixels, that blurring is calculated for the SSAO. \n" + - "Higher numbers will reduce banding at the cost of GPU performance." + - "") - .build(); - - public static ConfigEntry fadeDistanceInBlocks = new ConfigEntry.Builder() - .setMinDefaultMax(0, 1_600, 30_000_000) - .comment("" + - "The distance in blocks from the camera where the SSAO will fade out to. \n"+ - "This is done to prevent banding and noise at extreme distances. \n"+ - "") - .build(); - } public static class GenericRendering diff --git a/core/src/main/java/com/seibel/distanthorizons/core/render/renderer/shaders/SSAOApplyShader.java b/core/src/main/java/com/seibel/distanthorizons/core/render/renderer/shaders/SSAOApplyShader.java index fe3216160..19eccfc02 100644 --- a/core/src/main/java/com/seibel/distanthorizons/core/render/renderer/shaders/SSAOApplyShader.java +++ b/core/src/main/java/com/seibel/distanthorizons/core/render/renderer/shaders/SSAOApplyShader.java @@ -94,7 +94,7 @@ public class SSAOApplyShader extends AbstractShaderRenderer GLMC.glBindTexture(this.ssaoTexture); GL32.glUniform1i(this.gSSAOMapUniform, 1); - GL32.glUniform1i(this.gBlurRadiusUniform, Config.Client.Advanced.Graphics.Ssao.blurRadius.get()); + GL32.glUniform1i(this.gBlurRadiusUniform, 2); if (this.gViewSizeUniform >= 0) { diff --git a/core/src/main/java/com/seibel/distanthorizons/core/render/renderer/shaders/SSAOShader.java b/core/src/main/java/com/seibel/distanthorizons/core/render/renderer/shaders/SSAOShader.java index 8d1a0267b..d4b95d04f 100644 --- a/core/src/main/java/com/seibel/distanthorizons/core/render/renderer/shaders/SSAOShader.java +++ b/core/src/main/java/com/seibel/distanthorizons/core/render/renderer/shaders/SSAOShader.java @@ -108,26 +108,15 @@ public class SSAOShader extends AbstractShaderRenderer this.shader.setUniform(this.uInvProj, this.invertedProjection); - this.shader.setUniform(this.uSampleCount, Config.Client.Advanced.Graphics.Ssao.sampleCount.get()); - - // Explicit Number casts need to be done to prevent issues with the default value being an int - Number radius = Config.Client.Advanced.Graphics.Ssao.radius.get(); - this.shader.setUniform(this.uRadius, radius.floatValue()); - - Number strength = Config.Client.Advanced.Graphics.Ssao.strength.get(); - this.shader.setUniform(this.uStrength, strength.floatValue()); - - Number minLight = Config.Client.Advanced.Graphics.Ssao.minLight.get(); - this.shader.setUniform(this.uMinLight, minLight.floatValue()); - - Number bias = Config.Client.Advanced.Graphics.Ssao.bias.get(); - this.shader.setUniform(this.uBias, bias.floatValue()); + this.shader.setUniform(this.uSampleCount, 6); + this.shader.setUniform(this.uRadius, 4.0f); + this.shader.setUniform(this.uStrength, 0.2f); + this.shader.setUniform(this.uMinLight, 0.25f); + this.shader.setUniform(this.uBias, 0.02f); + this.shader.setUniform(this.uFadeDistanceInBlocks, 1_600.0f); GL32.glUniform1i(this.uDepthMap, 0); - float fadeDistanceInBlocks = Config.Client.Advanced.Graphics.Ssao.fadeDistanceInBlocks.get().floatValue(); - fadeDistanceInBlocks = MathUtil.clamp(0.0f, fadeDistanceInBlocks, Float.MAX_VALUE); // clamp to prevent accidentally setting a negative number - this.shader.setUniform(this.uFadeDistanceInBlocks, fadeDistanceInBlocks); }