Air Absorption
Rays lose LF and HF energy separately based on how far they travel through air.
There is an in-built air absorption formula that's based on humidity, temperature and pressure. You can adjust these values by setting a new AirAbsorption field:
context.AirAbsorption = new vaudio.AirAbsorptionSettings()
{
HumidityPercent = 0.1f,
TemperatureCelsius = 30.0f,
PressurePascals = 101325.0f,
};
Note that editing a specific property, e.g.
context.AirAbsorption.HumidityPercent = 0.3fwill not work. The entirecontext.AirAbsorptionproperty must be set
Air absorption is also affected by the MetersPerUnit, SpeedOfSound, FrequencyReferenceLF and FrequencyReferenceHF context settings.
You can also provide custom formulas for air absorption:
context.AirAbsorption = new vaudio.AirAbsorptionSettings()
{
CustomFormulaLF = (float distance) =>
{
// Return how much LF energy should be lost, in the range 0.0 to 1.0
return distance / 15000.0f;
},
CustomFormulaHF = (float distance) =>
{
// Return how much HF energy should be lost, in the range 0.0 to 1.0
return distance / 2000.0f;
}
};
You can also completely disable air absorption:
context.AirAbsorption = null;