Package com.google.android.filament
Class View.FogOptions
- java.lang.Object
-
- com.google.android.filament.View.FogOptions
-
- Enclosing class:
- View
public static class View.FogOptions extends java.lang.ObjectOptions to control large-scale fog in the scene
-
-
Field Summary
Fields Modifier and Type Field Description float[]colorFog's color is used for ambient light in-scattering, a good value is to use the average of the ambient light, possibly tinted towards blue for outdoors environments.floatcutOffDistanceDistance in world units [m] after which the fog calculation is disabled.floatdensityExtinction factor in [1/m] at altitude 'height'.floatdistanceDistance in world units [m] from the camera to where the fog starts ( >= 0.0 )booleanenabledEnable or disable large-scale fogbooleanfogColorFromIblThe fog color will be sampled from the IBL in the view direction and tinted by `color`.floatheightFog's floor in world units [m].floatheightFalloffHow fast the fog dissipates with altitude.floatinScatteringSizeVery inaccurately simulates the Sun's in-scattering.floatinScatteringStartDistance in world units [m] from the camera where the Sun in-scattering starts.floatmaximumOpacityfog's maximum opacity between 0 and 1
-
Constructor Summary
Constructors Constructor Description FogOptions()
-
-
-
Field Detail
-
distance
public float distance
Distance in world units [m] from the camera to where the fog starts ( >= 0.0 )
-
cutOffDistance
public float cutOffDistance
Distance in world units [m] after which the fog calculation is disabled. This can be used to exclude the skybox, which is desirable if it already contains clouds or fog. The default value is +infinity which applies the fog to everything. Note: The SkyBox is typically at a distance of 1e19 in world space (depending on the near plane distance and projection used though).
-
maximumOpacity
public float maximumOpacity
fog's maximum opacity between 0 and 1
-
height
public float height
Fog's floor in world units [m]. This sets the "sea level".
-
heightFalloff
public float heightFalloff
How fast the fog dissipates with altitude. heightFalloff has a unit of [1/m]. It can be expressed as 1/H, where H is the altitude change in world units [m] that causes a factor 2.78 (e) change in fog density. A falloff of 0 means the fog density is constant everywhere and may result is slightly faster computations.
-
color
@NonNull @Size(min=3L) public float[] color
Fog's color is used for ambient light in-scattering, a good value is to use the average of the ambient light, possibly tinted towards blue for outdoors environments. Color component's values should be between 0 and 1, values above one are allowed but could create a non energy-conservative fog (this is dependant on the IBL's intensity as well). We assume that our fog has no absorption and therefore all the light it scatters out becomes ambient light in-scattering and has lost all directionality, i.e.: scattering is isotropic. This somewhat simulates Rayleigh scattering. This value is used as a tint instead, when fogColorFromIbl is enabled.- See Also:
fogColorFromIbl
-
density
public float density
Extinction factor in [1/m] at altitude 'height'. The extinction factor controls how much light is absorbed and out-scattered per unit of distance. Each unit of extinction reduces the incoming light to 37% of its original value. Note: The extinction factor is related to the fog density, it's usually some constant K times the density at sea level (more specifically at fog height). The constant K depends on the composition of the fog/atmosphere. For historical reason this parameter is called `density`.
-
inScatteringStart
public float inScatteringStart
Distance in world units [m] from the camera where the Sun in-scattering starts.
-
inScatteringSize
public float inScatteringSize
Very inaccurately simulates the Sun's in-scattering. That is, the light from the sun that is scattered (by the fog) towards the camera. Size of the Sun in-scattering (>0 to activate). Good values are >> 1 (e.g. ~10 - 100). Smaller values result is a larger scattering size.
-
fogColorFromIbl
public boolean fogColorFromIbl
The fog color will be sampled from the IBL in the view direction and tinted by `color`. Depending on the scene this can produce very convincing results. This simulate a more anisotropic phase-function.
-
enabled
public boolean enabled
Enable or disable large-scale fog
-
-