Sound Propagation: Part 2: Difference between revisions

From The DarkMod Wiki
Jump to navigationJump to search
No edit summary
Demagogue (talk | contribs)
 
Line 15: Line 15:


However, in some cases, we may want to change a property in only one area, without going to the bother of setting up a location with info_location_separators for just one small area. That's why we have info_tdm_areadata, which overrides the location properties for the portal area that it is placed in.
However, in some cases, we may want to change a property in only one area, without going to the bother of setting up a location with info_location_separators for just one small area. That's why we have info_tdm_areadata, which overrides the location properties for the portal area that it is placed in.
Note: you may want to override some location properties but not others.  E.g., if you want to change the soundprop properties but keep the location ambient sound playing, or location-unique ambient light, you should re-enter those changes in the info_tdm_areadata to keep them for the portal area.


== Current Properties Ingame and How to Set Them ==
== Current Properties Ingame and How to Set Them ==

Latest revision as of 19:48, 29 July 2009

Originally written by Ishtvan on http://forums.thedarkmod.com/topic/3271

Mapping and Sound Propagation: Part 2

Assumed knowledge: How to place Visportals

Background: How to Create a Location (vanilla D3)

Suppose you have some portal areas that you want to group together as one location. (Incidentally, You will have to do this a lot if you want to use the D3 soundengine reverb/EAX settings.)

  1. Place an info_location entity in one of the areas. Set the "name" key to the name of your location (e.g., mansion_firstfloor, hallway_1, etc)
  2. Identify the visportals that you want to be the boundaries of your location.
  3. Place info_location_separator entities, one for each boundary portal, making sure that they touch the portal.

Soundprop Properties on Locations and Portal Areas

Soundprop properties that are specific to a certain point in space are stored in the key/value pairs of info_location entities, and on a new entity, info_tdm_areadata. A location covers several portal areas, so is useful for assigning the same properties to many areas without placing a lot of entities.

However, in some cases, we may want to change a property in only one area, without going to the bother of setting up a location with info_location_separators for just one small area. That's why we have info_tdm_areadata, which overrides the location properties for the portal area that it is placed in.

Note: you may want to override some location properties but not others. E.g., if you want to change the soundprop properties but keep the location ambient sound playing, or location-unique ambient light, you should re-enter those changes in the info_tdm_areadata to keep them for the portal area.

Current Properties Ingame and How to Set Them

First, some soundprop background needs to be explained:

Soundprop models acoustical loss in free space in two ways:

  1. Geometric spreading - A spherical wave spreads out as it travels, and the same initial energy is spread over a larger and larger surface area, which decreases the intensity at a particular point along the wavefront. This is the dominant mechanism for sound volume decreasing with distance. In our model, loss due to spreading is the same for the whole map and cannot be changed on a per-area basis. (Having unique spreading in each area would be possible, but would slow down the algorithm a lot.)
  2. Material loss - As the sound wave propagates in air, some energy is absorbed by the air molecules. This loss is typically small compared to geometric spreading. In reality, the loss varies with the humdity of the air, the temperature of the air, the elevation you're at, the frequency of the sound, etc. We chose a default value of 0.015 dB per meter, but mappers can modify this for individual areas.

Property - Material Loss Multiplier

This multiplies the 0.015 dB per meter loss value. By setting this, you effectively increase or decrease the rate that sound falls off within the area. However, note that you can't decrease the falloff that much even by setting this to zero, because geometric spreading loss is still incurred, and that's much larger than material loss at 0.015 dB/m. Therefore, you can only really increase the falloff rate using this loss multiplier.

An example use of this would be increasing the falloff rate for sounds that occur underwater. You can also "fake" effects like absorbing materials on the walls and ceiling by increasing the material loss, but this is not absolutely necessary and may just confuse the player if applied inconsistently.

Property - Volume Offset

This is a value in dB that's added (or subtracted) to any sound originating in the area. This is a non-physical "fudge factor," but might be used to model things not currently taken into account by soundprop, like whether a sound would reverberate loudly in a cathedral with hard stone walls.

How to Set the Properties

The properties are stored in key/value pairs placed on either an info_location entity or info_tdm_areadata. Properties entered on info_tdm_areadata entities apply to a single portal area, and override location properties. The key/values that store the properties are identical for both info_tdm_areadata and info_location:

  • sound_loss_mult "Soundprop: Multiplies the default atmospheric attenuation coefficeint (0.015 dB/m). Setting it to values greater than 1 will increase the falloff of sound with distance. Setting it to values less than 1 will not have much effect."
  • sound_vol_offset "Soundprop: Offsets the initial volume of any sound in this location by the given amount, in dB. Can be used to fake reverb effects for the AI."