summaryrefslogtreecommitdiffstats
path: root/cwd
diff options
context:
space:
mode:
authorLaG1924 <lag1924@gmail.com>2021-12-07 21:55:37 +0100
committerLaG1924 <lag1924@gmail.com>2021-12-07 22:27:55 +0100
commit039f05be5a548a9b5051b988869f984d7e335a47 (patch)
treea5d0f41fafcace53d9238dda0f56b5316089f0be /cwd
parentFixed SSAO normals (diff)
downloadAltCraft-039f05be5a548a9b5051b988869f984d7e335a47.tar
AltCraft-039f05be5a548a9b5051b988869f984d7e335a47.tar.gz
AltCraft-039f05be5a548a9b5051b988869f984d7e335a47.tar.bz2
AltCraft-039f05be5a548a9b5051b988869f984d7e335a47.tar.lz
AltCraft-039f05be5a548a9b5051b988869f984d7e335a47.tar.xz
AltCraft-039f05be5a548a9b5051b988869f984d7e335a47.tar.zst
AltCraft-039f05be5a548a9b5051b988869f984d7e335a47.zip
Diffstat (limited to 'cwd')
-rw-r--r--cwd/assets/altcraft/scripts/ui.lua3
-rw-r--r--cwd/assets/altcraft/shaders/frag/ssao.fs5
-rw-r--r--cwd/assets/altcraft/ui/options-styles.rcss4
-rw-r--r--cwd/assets/altcraft/ui/options.rml14
4 files changed, 18 insertions, 8 deletions
diff --git a/cwd/assets/altcraft/scripts/ui.lua b/cwd/assets/altcraft/scripts/ui.lua
index bc04626..5973fc4 100644
--- a/cwd/assets/altcraft/scripts/ui.lua
+++ b/cwd/assets/altcraft/scripts/ui.lua
@@ -8,7 +8,8 @@ local options = {
targetFps = 60,
vsync = false,
wireframe = false,
- ssao = false,
+ ssaoSamples = 0,
+ ssaoScale = 0.5,
}
function OpenOptions(doc)
diff --git a/cwd/assets/altcraft/shaders/frag/ssao.fs b/cwd/assets/altcraft/shaders/frag/ssao.fs
index 0615e8f..4ed93fd 100644
--- a/cwd/assets/altcraft/shaders/frag/ssao.fs
+++ b/cwd/assets/altcraft/shaders/frag/ssao.fs
@@ -8,6 +8,8 @@ uniform sampler2D normal;
uniform sampler2D worldPos;
uniform sampler2D ssaoNoise;
+uniform int ssaoSamples;
+
layout (std140) uniform Globals {
mat4 projView;
mat4 proj;
@@ -36,7 +38,8 @@ void main() {
mat3 TBN = mat3(tangent, bitangent, normal);
float occlusion = 0.0;
- for(int i = 0; i < kernelSize; i++)
+ int samples = min(kernelSize, ssaoSamples);
+ for(int i = 0; i < samples; i++)
{
vec3 samplePos = TBN * ssaoKernels[i].xyz;
samplePos = fragPos + samplePos * radius;
diff --git a/cwd/assets/altcraft/ui/options-styles.rcss b/cwd/assets/altcraft/ui/options-styles.rcss
index fbfc685..4822580 100644
--- a/cwd/assets/altcraft/ui/options-styles.rcss
+++ b/cwd/assets/altcraft/ui/options-styles.rcss
@@ -5,7 +5,7 @@
form {
width: 70%;
display: block;
- margin: 5% auto;
+ margin: 1% auto;
background-color: #211710;
}
@@ -80,5 +80,5 @@ input.range sliderarrowinc {
width: 45%;
height: 8%;
position: fixed;
- margin: 5% auto auto;
+ margin: 3% auto auto;
}
diff --git a/cwd/assets/altcraft/ui/options.rml b/cwd/assets/altcraft/ui/options.rml
index ea7c39e..7211ef2 100644
--- a/cwd/assets/altcraft/ui/options.rml
+++ b/cwd/assets/altcraft/ui/options.rml
@@ -62,11 +62,17 @@
</div>
<div class="option">
- <label>Ambient occlusion</label>
- <input type="checkbox" id="ssao" />
- <span id="ssao-val"></span>
+ <label>Ambient occlusion quality</label>
+ <input type="range" min="0" max="64" step="4" id="ssaoSamples" />
+ <span id="ssaoSamples-val"></span>
</div>
-
+
+ <div class="option">
+ <label>Ambient occlusion scale</label>
+ <input type="range" min="0.05" max="2.0" step="0.05" id="ssaoScale" />
+ <span id="ssaoScale-val"></span>
+ </div>
+
</form>
<button class="mc-button" id="done" onclick="CloseOptions(document)">Done</button>
</body>