Taper fog density at edge with a small gradient#1889
Open
slipher wants to merge 4 commits intoDaemonEngine:masterfrom
Open
Taper fog density at edge with a small gradient#1889slipher wants to merge 4 commits intoDaemonEngine:masterfrom
slipher wants to merge 4 commits intoDaemonEngine:masterfrom
Conversation
Member
Author
VReaperV
reviewed
Feb 6, 2026
Add a shader keyword that can be used to configure a gradient for fog density, which tapers to 0 at the edge of the fog. The density of the fog is scaled by a factor of (1 - exp(-k * t)) where t is the distance under the fog plane and k a configurable constant. fogGradient expFalloff <dist> configures the exponential falloff such that the density is at 50% of the maximum at <dist> qu from the fog plane. fogGradient const does the same thing as the current default - no gradient; hard-edged fog.
Make the default gradient like `fogGradient expFalloff 5`. This makes the fogs have softer edges without changing the appearance too much.
Member
|
Very nice! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Introduce the
fogGradientshader keyword as suggested in #1795 (comment), which can be used to configure a gradient for fog density that tapers to 0 at the edge of the fog. The density of the fog is scaled by a factor of1 - exp(-k * t)where t is the distance under the fog plane and k a configurable constant.fogGradient expFalloff <dist>configures the exponential falloff such that the density is at 50% of the maximum at<dist>qu from the fog plane.fogGradient constdoes the same thing as the current default - no gradient; hard-edged fog.Change the default to
fogGradient expFalloff 5instead of the current constant density. Before/after comparisons: