Skip to content

Commit a895526

Browse files
committed
fix: improve cloud sunset tint and atmosphere color accuracy
1 parent 6b95ac6 commit a895526

3 files changed

Lines changed: 12 additions & 12 deletions

File tree

src/scene/atmosphere.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ void main() {
3232
float brightness = mix(0.15, 1.0, sunBlend);
3333
3434
// Atmosphere base color with sunset shift near terminator
35-
vec3 dayColor = vec3(0.3, 0.6, 1.0);
36-
vec3 sunsetColor = vec3(1.0, 0.5, 0.2);
37-
float sunsetBlend = smoothstep(0.35, -0.15, NdotL);
35+
vec3 dayColor = vec3(0.25, 0.58, 1.0);
36+
vec3 sunsetColor = vec3(0.9, 0.45, 0.35);
37+
float sunsetBlend = smoothstep(0.6, -0.25, NdotL);
3838
vec3 atmosColor = mix(dayColor, sunsetColor, sunsetBlend);
3939
4040
// Forward-scatter glow: brighter when looking toward sun through the limb
@@ -56,7 +56,7 @@ export class Atmosphere {
5656

5757
constructor() {
5858
const radius = (EARTH_RADIUS_KM + 80.0) / DRAW_SCALE;
59-
const geometry = new THREE.SphereGeometry(radius, 64, 64);
59+
const geometry = new THREE.SphereGeometry(radius, 128, 128);
6060

6161
this.material = new THREE.ShaderMaterial({
6262
uniforms: {

src/shaders/cloud.frag.glsl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ void main() {
1313
float intensity = dot(normal, sunDir);
1414
float alpha = smoothstep(-0.15, 0.05, intensity);
1515

16-
// Sunset tint on clouds: 2-stop gradient, multiplicative
17-
float scatterMult = smoothstep(-0.15, 0.25, intensity) * smoothstep(0.25, -0.15, intensity);
18-
vec3 sunsetDeep = vec3(0.85, 0.2, 0.08);
19-
vec3 sunsetWarm = vec3(1.0, 0.55, 0.2);
20-
float gradPos = smoothstep(-0.12, 0.12, intensity);
16+
// Sunset tint on clouds: ISS-derived colors, normalized bell curve
17+
float scatterMult = min(smoothstep(-0.3, 0.15, intensity) * smoothstep(0.15, -0.15, intensity) * 4.0, 1.0);
18+
vec3 sunsetDeep = vec3(0.75, 0.08, 0.10);
19+
vec3 sunsetWarm = vec3(1.0, 0.65, 0.55);
20+
float gradPos = smoothstep(-0.1, 0.0, intensity);
2121
vec3 sunsetColor = mix(sunsetDeep, sunsetWarm, gradPos);
22-
vec3 cloudColor = mix(texel.rgb, texel.rgb * sunsetColor * 1.5, scatterMult * 0.6);
22+
vec3 cloudColor = mix(texel.rgb, sunsetColor, scatterMult * 0.7);
2323

2424
gl_FragColor = vec4(cloudColor, texel.a * alpha);
2525
}

src/shaders/earth-daynight.frag.glsl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,11 @@ void main() {
8181
vec3 sunsetWarm = vec3(1.0, 0.55, 0.2);
8282
float gradPos = smoothstep(-0.12, 0.12, intensity);
8383
vec3 sunsetColor = mix(sunsetDeep, sunsetWarm, gradPos);
84-
vec3 scatteredDay = mix(day.rgb * ao, day.rgb * ao * sunsetColor * 1.5, scatterMult * 0.5);
84+
vec3 scatteredDay = mix(day.rgb * ao, day.rgb * ao * sunsetColor * 1.5, scatterMult * 0.15);
8585

8686
// Surface haze: blue-to-sunset atmospheric haze near terminator
8787
vec3 hazeColor = mix(vec3(0.15, 0.35, 0.75), sunsetColor, scatterMult);
88-
float surfaceHaze = pow(max(1.0 - abs(intensity), 0.0), 2.0) * smoothstep(-0.1, 0.2, intensity) * 0.35;
88+
float surfaceHaze = pow(max(1.0 - abs(intensity), 0.0), 2.0) * smoothstep(-0.1, 0.2, intensity) * 0.1;
8989
scatteredDay = mix(scatteredDay, hazeColor, surfaceHaze);
9090

9191
// Boost night emission for bloom (HDR values > 1.0)

0 commit comments

Comments
 (0)