Skip to content

TSL: Add exponentialHeightFogFactor().#32659

Merged
Mugen87 merged 3 commits intomrdoob:devfrom
Mugen87:dev2
Jan 4, 2026
Merged

TSL: Add exponentialHeightFogFactor().#32659
Mugen87 merged 3 commits intomrdoob:devfrom
Mugen87:dev2

Conversation

@Mugen87
Copy link
Collaborator

@Mugen87 Mugen87 commented Jan 2, 2026

Related issue: #32613 (comment)

Description

I've experimented with fog code lately and this is the simplest exponential height fog I can think of. You have a density parameter to control the global fog density (similar to densityFogFactor()) and an additional height parameter in world space that defines the height (y-coordinate) threshold when fragments are affected by fog.

image

Link for testing: https://rawcdn.githack.com/Mugen87/three.js/c0a7e5ee23e4ec5d5ef209727ed352e97aa192f1/examples/webgpu_fog_height.html

I'll temporarily update the builds for testing.

@github-actions
Copy link

github-actions bot commented Jan 2, 2026

📦 Bundle size

Full ESM build, minified and gzipped.

Before After Diff
WebGL 355.36
84.47
355.36
84.47
+0 B
+0 B
WebGPU 621.34
172.52
621.49
172.57
+158 B
+50 B
WebGPU Nodes 619.94
172.27
620.1
172.32
+158 B
+51 B

🌳 Bundle size after tree-shaking

Minimal build including a renderer, camera, empty scene, and dependencies.

Before After Diff
WebGL 487.23
119.23
487.23
119.23
+0 B
+0 B
WebGPU 692.28
187.78
692.41
187.81
+131 B
+33 B
WebGPU Nodes 642.08
175
642.21
175.03
+131 B
+34 B

@Mugen87 Mugen87 marked this pull request as draft January 2, 2026 18:17
@Mugen87 Mugen87 force-pushed the dev2 branch 2 times, most recently from 45dbbc5 to 7dcfefa Compare January 2, 2026 19:01
@Mugen87 Mugen87 marked this pull request as ready for review January 2, 2026 19:14
@Mugen87 Mugen87 merged commit e7a94ca into mrdoob:dev Jan 4, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants