From 293e3157de5b16d5278aa42a77a3221ec5276547 Mon Sep 17 00:00:00 2001 From: Quentin Bazin Date: Fri, 17 Jul 2020 19:44:28 +0200 Subject: [PATCH] [ChunkBuilder] Don't apply AO on light sources. --- resources/shaders/game.f.glsl | 2 +- resources/shaders/game.v.glsl | 2 +- source/client/world/ChunkBuilder.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/resources/shaders/game.f.glsl b/resources/shaders/game.f.glsl index 0ad478e0a..714baacb6 100644 --- a/resources/shaders/game.f.glsl +++ b/resources/shaders/game.f.glsl @@ -73,7 +73,7 @@ void main() { if (blockFace == 2. || blockFace == 3.) ambientIntensity = max(ambientIntensity * 0.9, minBrightness); - float lightval = clamp(sunlight / 16.0, v_lightValue.y / 16.0, 1.0); + float lightval = clamp(sunlight / 15.0, v_lightValue.y / 15.0, 1.0); color = light(color, vec3(lightval, lightval, lightval), v_coord3d, ambientIntensity, diffuseIntensity); } diff --git a/resources/shaders/game.v.glsl b/resources/shaders/game.v.glsl index 09d89bcfd..1205300a3 100644 --- a/resources/shaders/game.v.glsl +++ b/resources/shaders/game.v.glsl @@ -49,7 +49,7 @@ void main() { v_lightValue = lightValue; if (ambientOcclusion != 5) { - const float aovalues[] = float[](0.25, 0.5, 0.75, 1.0); + const float aovalues[] = float[](0.2, 0.45, 0.75, 1.0); v_ambientOcclusion = aovalues[int(ambientOcclusion)]; } else { v_ambientOcclusion = 1.0; diff --git a/source/client/world/ChunkBuilder.cpp b/source/client/world/ChunkBuilder.cpp index 3d6d954d8..6aabef520 100644 --- a/source/client/world/ChunkBuilder.cpp +++ b/source/client/world/ChunkBuilder.cpp @@ -260,7 +260,7 @@ inline void ChunkBuilder::addFace(s8f x, s8f y, s8f z, s8f f, const ClientChunk } auto addVertex = [&](u8 v) { - if (Config::ambientOcclusion != 1) + if (Config::ambientOcclusion != 1 || blockState.isLightSource()) vertices[v].ambientOcclusion = 5; if (blockState.drawType() == BlockDrawType::Liquid)