Skip to content

Introduce FogExp and consider refactoring+FogLinear #17264

@EliasHasle

Description

@EliasHasle

In https://github.com/mrdoob/three.js/blob/dev/src/renderers/shaders/ShaderChunk/fog_fragment.glsl.js, under the FOG_EXP2 ifdef:

float fogFactor = whiteCompliment( exp2( - fogDensity * fogDensity * fogDepth * fogDepth * LOG2 ) );

Is exp2(something*LOG2) intended here? LOG2 is 1/ln(2), and exp2 is the base 2 exponential, so the expression simplifies to exp(something).

I also wonder why the density and depth are squared. What is the physical analogy? For comparison, they are not squared in the implementation here: https://iquilezles.org/www/articles/fog/fog.htm

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions