From b3492d801efa12dee8a1176fbf59ca6588dda79c Mon Sep 17 00:00:00 2001 From: Zemledelec Date: Fri, 19 Sep 2025 16:40:01 +0400 Subject: [PATCH] 926 tests.2 --- src/control/atmosphere/Atmosphere.ts | 1 + src/control/atmosphere/atmosphere.frag.glsl | 10 +++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/control/atmosphere/Atmosphere.ts b/src/control/atmosphere/Atmosphere.ts index e2aae9a5..fb6ad6b5 100644 --- a/src/control/atmosphere/Atmosphere.ts +++ b/src/control/atmosphere/Atmosphere.ts @@ -254,6 +254,7 @@ export class Atmosphere extends Control { gl.disable(gl.DEPTH_TEST); r.enableBlendOneSrcAlpha(); + //r.enableBlendDefault(); sh.activate(); gl.bindBuffer(gl.ARRAY_BUFFER, r.screenFramePositionBuffer!); diff --git a/src/control/atmosphere/atmosphere.frag.glsl b/src/control/atmosphere/atmosphere.frag.glsl index 75976997..f095e873 100644 --- a/src/control/atmosphere/atmosphere.frag.glsl +++ b/src/control/atmosphere/atmosphere.frag.glsl @@ -12,6 +12,14 @@ uniform float opacity; uniform sampler2D transmittanceTexture; uniform sampler2D scatteringTexture; +float valueHSV(vec3 rgb) { + return max(max(rgb.r, rgb.g), rgb.b); +} + +float luma601(vec3 srgb) { + return dot(srgb, vec3(0.299, 0.587, 0.114)); +} + vec3 transmittanceFromTexture(float height, float angle) { float u = (angle + 1.0) * 0.5; @@ -180,7 +188,7 @@ void mainImage(out vec4 fragColor) light += sunLum * SUN_INTENSITY * transmittanceFromCameraToSpace; } - fragColor = vec4(pow(light * 8.0, vec3(1.0 / 2.2)), length(light) * clamp(opacity, 0.0, 1.0)); + fragColor = vec4(pow(opacity * light * 8.0, vec3(1.0 / 2.2)), valueHSV(light) * clamp(opacity, 0.0, 1.0)); } void main(void)