reset default ssao settings
This commit is contained in:
+6
-4
@@ -86,13 +86,15 @@ public interface IDhApiGraphicsConfig extends IDhApiConfigGroup
|
||||
|
||||
IDhApiConfigValue<Boolean> ambientOcclusion();
|
||||
|
||||
IDhApiConfigValue<Double> ambientOcclusionRadius();
|
||||
IDhApiConfigValue<Integer> ambientOcclusion_SampleCount();
|
||||
|
||||
IDhApiConfigValue<Double> ambientOcclusionStrength();
|
||||
IDhApiConfigValue<Double> ambientOcclusion_Radius();
|
||||
|
||||
IDhApiConfigValue<Double> ambientOcclusionBias();
|
||||
IDhApiConfigValue<Double> ambientOcclusion_Strength();
|
||||
|
||||
IDhApiConfigValue<Double> ambientOcclusionMinLight();
|
||||
IDhApiConfigValue<Double> ambientOcclusion_Bias();
|
||||
|
||||
IDhApiConfigValue<Double> ambientOcclusion_MinLight();
|
||||
|
||||
IDhApiConfigValue<ETransparency> transparency();
|
||||
|
||||
|
||||
+8
-4
@@ -85,19 +85,23 @@ public class DhApiGraphicsConfig implements IDhApiGraphicsConfig
|
||||
{ return new DhApiConfigValue<Boolean, Boolean>(Config.Client.Advanced.Graphics.Quality.ssao); }
|
||||
|
||||
@Override
|
||||
public IDhApiConfigValue<Double> ambientOcclusionRadius()
|
||||
public IDhApiConfigValue<Integer> ambientOcclusion_SampleCount()
|
||||
{ return new DhApiConfigValue<Integer, Integer>(Config.Client.Advanced.Graphics.Quality.ssaoSampleCount); }
|
||||
|
||||
@Override
|
||||
public IDhApiConfigValue<Double> ambientOcclusion_Radius()
|
||||
{ return new DhApiConfigValue<Double, Double>(Config.Client.Advanced.Graphics.Quality.ssaoRadius); }
|
||||
|
||||
@Override
|
||||
public IDhApiConfigValue<Double> ambientOcclusionStrength()
|
||||
public IDhApiConfigValue<Double> ambientOcclusion_Strength()
|
||||
{ return new DhApiConfigValue<Double, Double>(Config.Client.Advanced.Graphics.Quality.ssaoStrength); }
|
||||
|
||||
@Override
|
||||
public IDhApiConfigValue<Double> ambientOcclusionBias()
|
||||
public IDhApiConfigValue<Double> ambientOcclusion_Bias()
|
||||
{ return new DhApiConfigValue<Double, Double>(Config.Client.Advanced.Graphics.Quality.ssaoBias); }
|
||||
|
||||
@Override
|
||||
public IDhApiConfigValue<Double> ambientOcclusionMinLight()
|
||||
public IDhApiConfigValue<Double> ambientOcclusion_MinLight()
|
||||
{ return new DhApiConfigValue<Double, Double>(Config.Client.Advanced.Graphics.Quality.ssaoMinLight); }
|
||||
|
||||
@Override
|
||||
|
||||
@@ -179,23 +179,28 @@ public class Config
|
||||
.comment("Enable Screen Space Ambient Occlusion")
|
||||
.build();
|
||||
|
||||
public static ConfigEntry<Integer> ssaoSampleCount = new ConfigEntry.Builder<Integer>()
|
||||
.set(6)
|
||||
.comment("Number of samples to use for Screen Space Ambient Occlusion")
|
||||
.build();
|
||||
|
||||
public static ConfigEntry<Double> ssaoRadius = new ConfigEntry.Builder<Double>()
|
||||
.set(3.0)
|
||||
.set(4.0)
|
||||
.comment("Radius of Screen Space Ambient Occlusion effect in blocks")
|
||||
.build();
|
||||
|
||||
public static ConfigEntry<Double> ssaoStrength = new ConfigEntry.Builder<Double>()
|
||||
.set(6.0)
|
||||
.set(0.2)
|
||||
.comment("Strength of Screen Space Ambient Occlusion effect")
|
||||
.build();
|
||||
|
||||
public static ConfigEntry<Double> ssaoBias = new ConfigEntry.Builder<Double>()
|
||||
.set(0.0)
|
||||
.set(0.02)
|
||||
.comment("Bias of Screen Space Ambient Occlusion effect")
|
||||
.build();
|
||||
|
||||
public static ConfigEntry<Double> ssaoMinLight = new ConfigEntry.Builder<Double>()
|
||||
.set(0.3)
|
||||
.set(0.25)
|
||||
.comment("Minimum brightness of Screen Space Ambient Occlusion effect")
|
||||
.build();
|
||||
|
||||
|
||||
+4
@@ -52,6 +52,7 @@ public class SSAORenderer
|
||||
{
|
||||
public int gProjUniform;
|
||||
public int gInvProjUniform;
|
||||
public int gSampleCountUniform;
|
||||
public int gRadiusUniform;
|
||||
public int gStrengthUniform;
|
||||
public int gBiasUniform;
|
||||
@@ -97,6 +98,7 @@ public class SSAORenderer
|
||||
// SSAO uniform setup
|
||||
this.ssaoShaderUniforms.gProjUniform = this.ssaoShader.getUniformLocation("gProj");
|
||||
this.ssaoShaderUniforms.gInvProjUniform = this.ssaoShader.getUniformLocation("gInvProj");
|
||||
this.ssaoShaderUniforms.gSampleCountUniform = this.ssaoShader.getUniformLocation("gSampleCount");
|
||||
this.ssaoShaderUniforms.gRadiusUniform = this.ssaoShader.getUniformLocation("gRadius");
|
||||
this.ssaoShaderUniforms.gStrengthUniform = this.ssaoShader.getUniformLocation("gStrength");
|
||||
this.ssaoShaderUniforms.gMinLightUniform = this.ssaoShader.getUniformLocation("gMinLight");
|
||||
@@ -189,6 +191,7 @@ public class SSAORenderer
|
||||
Mat4f invertedPerspective = new Mat4f(perspective);
|
||||
invertedPerspective.invert();
|
||||
|
||||
int sampleCount = Config.Client.Advanced.Graphics.Quality.ssaoSampleCount.get();
|
||||
float radius = Config.Client.Advanced.Graphics.Quality.ssaoRadius.get().floatValue();
|
||||
float strength = Config.Client.Advanced.Graphics.Quality.ssaoStrength.get().floatValue();
|
||||
float minLight = Config.Client.Advanced.Graphics.Quality.ssaoMinLight.get().floatValue();
|
||||
@@ -197,6 +200,7 @@ public class SSAORenderer
|
||||
this.ssaoShader.bind();
|
||||
this.ssaoShader.setUniform(this.ssaoShaderUniforms.gProjUniform, perspective);
|
||||
this.ssaoShader.setUniform(this.ssaoShaderUniforms.gInvProjUniform, invertedPerspective);
|
||||
this.ssaoShader.setUniform(this.ssaoShaderUniforms.gSampleCountUniform, sampleCount);
|
||||
this.ssaoShader.setUniform(this.ssaoShaderUniforms.gRadiusUniform, radius);
|
||||
this.ssaoShader.setUniform(this.ssaoShaderUniforms.gStrengthUniform, strength);
|
||||
this.ssaoShader.setUniform(this.ssaoShaderUniforms.gMinLightUniform, minLight);
|
||||
|
||||
@@ -96,6 +96,8 @@
|
||||
"How quickly LODs drop off in quality.\n\nLarger numbers will improve how distant terrain looks\nbut will increase memory and GPU usage.",
|
||||
"distanthorizons.config.client.advanced.graphics.quality.ssao":
|
||||
"SSAO",
|
||||
"distanthorizons.config.client.advanced.graphics.quality.ssaoSampleCount":
|
||||
"SSAO Sample Count",
|
||||
"distanthorizons.config.client.advanced.graphics.quality.ssaoRadius":
|
||||
"SSAO Radius",
|
||||
"distanthorizons.config.client.advanced.graphics.quality.ssaoStrength":
|
||||
|
||||
@@ -4,13 +4,12 @@
|
||||
#define saturate(x) (clamp((x), 0.0, 1.0))
|
||||
#define rcp(x) (1.0 / (x))
|
||||
|
||||
const float SSAO_SAMPLES = 24; // [2 4 6 8 10 12 14 16 24 32]
|
||||
|
||||
in vec2 TexCoord;
|
||||
|
||||
out vec4 fragColor;
|
||||
|
||||
uniform sampler2D gDepthMap;
|
||||
uniform int gSampleCount;
|
||||
uniform float gRadius;
|
||||
uniform float gStrength;
|
||||
uniform float gMinLight;
|
||||
@@ -41,7 +40,7 @@ vec3 calcViewPosition(const in vec3 clipPos) {
|
||||
|
||||
|
||||
float GetSpiralOcclusion(const in vec2 uv, const in vec3 viewPos, const in vec3 viewNormal) {
|
||||
const float inv = rcp(SSAO_SAMPLES);
|
||||
float inv = rcp(gSampleCount);
|
||||
float rStep = inv * gRadius;
|
||||
|
||||
float dither = InterleavedGradientNoise(gl_FragCoord.xy);
|
||||
@@ -52,7 +51,7 @@ float GetSpiralOcclusion(const in vec2 uv, const in vec3 viewPos, const in vec3
|
||||
|
||||
float ao = 0.0;
|
||||
int sampleCount = 0;
|
||||
for (int i = 0; i < SSAO_SAMPLES; i++) {
|
||||
for (int i = 0; i < gSampleCount; i++) {
|
||||
offset.x = sin(rotatePhase);
|
||||
offset.y = cos(rotatePhase);
|
||||
offset *= radius;
|
||||
@@ -83,9 +82,6 @@ float GetSpiralOcclusion(const in vec2 uv, const in vec3 viewPos, const in vec3
|
||||
}
|
||||
|
||||
ao /= max(sampleCount, 1);
|
||||
//ao = max(ao - SSAO_THRESHOLD, 0.0) * gStrength;
|
||||
//ao /= ao + 0.25;
|
||||
|
||||
ao = smoothstep(0.0, gStrength, ao);
|
||||
|
||||
return ao * (1.0 - gMinLight);
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
#define ENABLE_SSAO_BLUR
|
||||
|
||||
in vec2 TexCoord;
|
||||
//in vec2 ViewRay;
|
||||
|
||||
out vec4 fragColor;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user