This function converts raytracing energy values to ambient permeation gain values. The `AmbientGainFormula` is invoked twice per emitter: - Once with low-frequency energy values - Once with high-frequency energy values The results of these functions are stored directly on the emitter's `AmbientPermeationGainLF` and `AmbientPermeationGainHF` fields. The default formula specifies that 100% of permeation energy is required for a ambient sounds to be at max gain: ```cs emitter.AmbientGainFormula = (int ambientPermeationRayCount, int ambientPermeationBounceCount, float energy) => { float totalEnergy = 0.0f; if (ambientPermeationRayCount > 0) { float rayThreshold = 1.0f * (ambientPermeationRayCount * ambientPermeationBounceCount); totalEnergy += energy / rayThreshold; } return MathF.Min(1, totalEnergy); } ``` Parameters: - `ambientPermeationRayCount` is the number of ambient permeation rays that were cast by this emitter - `ambientPermeationBounceCount` is the number of times each ambient permeation ray bounces - `energy` is in the range 0.0 to 1.0, where 1.0 means all permeation rays reached the world edge with maximum energy remaining (i.e. all rays passed through air)