Skip to content

Commit a90019b

Browse files
Remove nonlinear fog from FL0 (#9658)
* Remove fog and lighting uniforms from FL0 --------- Co-authored-by: Mathias Agopian <mathias@google.com>
1 parent 72997ee commit a90019b

File tree

3 files changed

+10
-15
lines changed

3 files changed

+10
-15
lines changed

libs/filamat/src/shaders/UibGenerator.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -182,16 +182,16 @@ BufferInterfaceBlock const& UibGenerator::getPerViewUib() noexcept {
182182
// ------------------------------------------------------------------------------------
183183
// Fog [variant: FOG]
184184
// ------------------------------------------------------------------------------------
185-
{ "fogDensity", 0, Type::FLOAT3,Precision::HIGH, FeatureLevel::FEATURE_LEVEL_0 },
185+
{ "fogDensity", 0, Type::FLOAT3,Precision::HIGH },
186186
{ "fogStart", 0, Type::FLOAT, Precision::HIGH, FeatureLevel::FEATURE_LEVEL_0 },
187-
{ "fogMaxOpacity", 0, Type::FLOAT, Precision::DEFAULT, FeatureLevel::FEATURE_LEVEL_0 },
187+
{ "fogMaxOpacity", 0, Type::FLOAT, Precision::DEFAULT },
188188
{ "fogMinMaxMip", 0, Type::UINT, Precision::HIGH },
189-
{ "fogHeightFalloff", 0, Type::FLOAT, Precision::HIGH, FeatureLevel::FEATURE_LEVEL_0 },
189+
{ "fogHeightFalloff", 0, Type::FLOAT, Precision::HIGH },
190190
{ "fogCutOffDistance", 0, Type::FLOAT, Precision::HIGH, FeatureLevel::FEATURE_LEVEL_0 },
191191
{ "fogColor", 0, Type::FLOAT3, Precision::DEFAULT, FeatureLevel::FEATURE_LEVEL_0 },
192-
{ "fogColorFromIbl", 0, Type::FLOAT, Precision::DEFAULT, FeatureLevel::FEATURE_LEVEL_0 },
193-
{ "fogInscatteringStart", 0, Type::FLOAT, Precision::HIGH, FeatureLevel::FEATURE_LEVEL_0 },
194-
{ "fogInscatteringSize", 0, Type::FLOAT, Precision::DEFAULT, FeatureLevel::FEATURE_LEVEL_0 },
192+
{ "fogColorFromIbl", 0, Type::FLOAT, Precision::DEFAULT },
193+
{ "fogInscatteringStart", 0, Type::FLOAT, Precision::HIGH },
194+
{ "fogInscatteringSize", 0, Type::FLOAT, Precision::DEFAULT },
195195
{ "fogOneOverFarMinusNear", 0, Type::FLOAT, Precision::HIGH },
196196
{ "fogNearOverFarMinusNear", 0, Type::FLOAT, Precision::HIGH },
197197
{ "fogFromWorldMatrix", 0, Type::MAT3, Precision::HIGH, FeatureLevel::FEATURE_LEVEL_0 },

shaders/src/surface_fog.fs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,9 @@
33
// see: Real-time Atmospheric Effects in Games (Carsten Wenzel)
44
//------------------------------------------------------------------------------
55

6-
vec4 fog(highp vec3 view
76
#if MATERIAL_FEATURE_LEVEL > 0
8-
, const mediump samplerCube fogColorTexture
9-
#endif
10-
)
11-
{
7+
8+
vec4 fog(highp vec3 view, const mediump samplerCube fogColorTexture) {
129
// note: d can be +inf with the skybox
1310
highp float d = length(view);
1411

@@ -86,6 +83,8 @@ vec4 fog(highp vec3 view
8683
return vec4(fogColor, fogOpacity);
8784
}
8885

86+
#endif // MATERIAL_FEATURE_LEVEL > 0
87+
8988
// A linear approximation of the fog function
9089
vec4 fogLinear(highp vec3 view
9190
#if MATERIAL_FEATURE_LEVEL > 0

shaders/src/surface_main.fs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,7 @@ void main() {
7373
vec4 fogColor = fog(view, sampler0_fog);
7474
# endif
7575
#else
76-
# if defined (FILAMENT_LINEAR_FOG)
7776
vec4 fogColor = fogLinear(view);
78-
# else
79-
vec4 fogColor = fog(view);
80-
# endif
8177
#endif
8278

8379
# if defined(BLEND_MODE_OPAQUE)

0 commit comments

Comments
 (0)