Jump to content


Photo

EFX discussion


36 replies to this topic

#1 Springheel

Springheel

    Creative Director (retired)

  • Admin
  • 36631 posts

Posted 03 December 2017 - 10:02 AM

*
POPULAR

http://bugs.thedarkm...iew.php?id=4688

 

I have a concern about EFX.

 

There seems to be general agreement that EFX is currently affecting sounds that it shouldn't affect, like gui sounds.  But we've had no discussions about what the full list of unaffected sounds will be, or how mappers will specify this.  For example, what about ambient sounds?  Clearly we don't want it to affect ambient music, but what about ambient noises?  Many of these, like the random sewer sounds of rats, already have strong reverb baked in and might sound too distorted if affected by EFX.  But not all do.  How does a mapper have EFX affect some ambient sounds but not others?

 

My concern is that if we don't establish some rules now, then we'll be in a situation for the next update where we're locked into not doing things that will break new maps, or mappers will have their carefully-planned sounds changed by the new rules.


  • Judith, lowenz, HMart and 4 others like this

#2 grayman

grayman

    Master Builder, Coder

  • Active Developer
  • PipPipPipPipPip
  • 12079 posts

Posted 03 December 2017 - 10:35 AM

Is there a set of sounds that we already know aren't affected by EFX?

 

Are they unaffected because of some setting in their sound shaders?

 

Or is the EFX code looking at the attributes of the sound itself (mono vs. stereo) to decide whether to apply EFX?



#3 stgatilov

stgatilov

    Advanced Member

  • Development Role
  • PipPipPip
  • 517 posts

Posted 03 December 2017 - 10:54 AM

EFX code is not looking at anything, I'm afraid.

 

 

There are many "effects", one effect per EFX file entry.

There is a single "auxilliary effect slot" called "listenerSlot" (see snd_world.cpp).

As far as I understand the OpenAL system, you attach an effect to a slot (using alAuxiliaryEffectSloti with AL_EFFECTSLOT_EFFECT), and then you send any sound sources into this slot to get them affected.

 

Look where "listenerSlot" is used in snd_world.cpp.

Excluding Init and Shutdown, there are only two other places:

 

Here engine sets the effect for the slot:

// only update if change in settings
if (listenerEffect != effect || justReloaded) {
  common->Printf("Switching to EFX '%s' (#%u)\n", s.c_str(), effect);
  listenerEffect = effect;
  soundSystemLocal.alAuxiliaryEffectSloti(listenerSlot, AL_EFFECTSLOT_EFFECT, effect);
}

And here the sound sources are sent to the slot:

if (idSoundSystemLocal::useEFXReverb) {
    if (enviroSuitActive) {
        alSourcei(chan->openalSource, AL_DIRECT_FILTER, listenerFilter);
        alSource3i(chan->openalSource, AL_AUXILIARY_SEND_FILTER, listenerSlot, 0, listenerFilter);
    }
    else {
        alSource3i(chan->openalSource, AL_AUXILIARY_SEND_FILTER, listenerSlot, 0, AL_FILTER_NULL);
    }
}

I see no checks around this piece of code, so it seems that every OpenAL source is sent into the slot and is affected by the EFX effect.

 

 



#4 Springheel

Springheel

    Creative Director (retired)

  • Admin
  • 36631 posts

Posted 03 December 2017 - 11:08 AM

At the moment, even things like "objective complete" sounds are being affected by EFX.

 

Anyone object to me moving this to the public forums?  It would be useful to have Judith's input on this, as he's digging into all the EFX spawnargs.


  • Bikerdude and Judith like this

#5 stgatilov

stgatilov

    Advanced Member

  • Development Role
  • PipPipPip
  • 517 posts

Posted 03 December 2017 - 12:05 PM

 It would be useful to have Judith's input on this, as he's digging into all the EFX spawnargs.

 

I'm afraid there is nothing like "EFX spawnargs".

 

He is investigating the parameters in EFX file.

EFX file can only specify location where each effect is applied, it does not allow to set any conditions like "affect only such sounds".



#6 Judith

Judith

    Advanced Member

  • Member
  • PipPipPip
  • 762 posts

Posted 03 December 2017 - 03:30 PM

Thanks Spring for including me. AFAIK, EFX is affecting all the sounds, only the game menu is excluded.

 

Edit:

 

There seems to be general agreement that EFX is currently affecting sounds that it shouldn't affect, like gui sounds.  But we've had no discussions about what the full list of unaffected sounds will be, or how mappers will specify this.  For example, what about ambient sounds?  Clearly we don't want it to affect ambient music, but what about ambient noises?  Many of these, like the random sewer sounds of rats, already have strong reverb baked in and might sound too distorted if affected by EFX.  But not all do.  How does a mapper have EFX affect some ambient sounds but not others?

 

I don't think that's possible, as Stgatilov mentioned. EFX is just a set of parameters for modelling acoustic profiles of rooms or spaces in game levels. I have no idea about coding, coding sound included, but the first thing that came to my mind is that if sounds are affected by EFX, then they must be played within 3d space, and not on another "layer". Thief 3 called "2D sound" everything that was played in "players head", and back when EAX worked in Thief 3, those sounds were not affected. Maybe that's the problem, aren't UI sounds played from a speaker attached to the player model or something?


Edited by Judith, 03 December 2017 - 04:11 PM.


#7 demagogue

demagogue

    Mod hero

  • Active Developer
  • PipPipPipPipPip
  • 5254 posts

Posted 03 December 2017 - 06:37 PM

My first idea, if the system is really going to be blind to the entire category of GUI / ambient / out-of-world sounds, is to opt them out in the code by the file name and have a spawnarg somewhere that allows mappers to opt their custom sounds out in the same way.


Posted Image

#8 Abusimplea

Abusimplea

    Member

  • Member
  • PipPip
  • 181 posts

Posted 03 December 2017 - 07:44 PM

I guess, with EFX, sounds are like textures: They normally should not include any shadows or reverb baked in.

It should be possible to exclude sound shaders from EFX in sound shader files and by setting spawn args in DR. Mission authors will probably use both methods depending on whether they add custom sounds or recycle existing ones. Also might need to implement a way to disable EFX for sounds in GUIs.

 

A blacklist might be good for a temporary quick fix until the real solutions got built in.



#9 Destined

Destined

    Advanced Member

  • Member
  • PipPipPip
  • 1318 posts

Posted 04 December 2017 - 02:04 AM

If I understand correctly, EFX is based on the location system in that it checks, where the player is and then applies the respective effects to all sounds. Would it be possible to check instead, which sounds are in an area and apply the respective effects on only these sounds? This way it would not affect any menu sounds (as these are not in any area) and would also not break any old missions as long as the location system is not used and/or EFX is not defined for any missions.



#10 Judith

Judith

    Advanced Member

  • Member
  • PipPipPip
  • 762 posts

Posted 04 December 2017 - 03:13 AM

If I understand correctly, EFX is based on the location system in that it checks, where the player is and then applies the respective effects to all sounds.

 

Yes.

 

Would it be possible to check instead, which sounds are in an area and apply the respective effects on only these sounds?

 

No. EFX is an external, third-party system for modeling reverb, and that applies to everything in a 3d space. Game menu is considered 2d so EFX doesn't apply to it. My guess is that we need some kind of invisible gui/windowDef in game that would play "2d sounds" like music, player monologue, player grunts and UI sounds. Thief 3 system wasn't bad in that regard.

 

On more general note, as we discussed it a bit in another thread, I think the current way we use sounds is a bit messy.

 

For now, SFX works like master volume, as it turns down player and AI footsteps, voices, music via location system and sounds placed in the speakers within the level, etc. Ambient volume affects both music via location system and sounds placed in speakers on the map, so it's kind of useless.

 

IMO, from player perspective, we need more self-explanatory system, i.e. channels, and volume sliders like Music, SFX, Speech, and Video. E.g. (as in Dishonored 2):

 

Music affects menu music and mission background music (i.e. the one played through our equivalent of location system, and not placed in a speaker in the map). SFX slider affects all UI and menu sounds, player footstep sounds, and basically all sounds placed in the map. Speech affects internal monologue, voices of AIs placed in the map, and player grunts.

 

 

So in a long run, we'd have sound channels for playing and adjusting the volume properly, and on another level, distnction between 2d and 3d for EFX.

I guess there's no way around it, it will be a pain in the ass to make it work :/

 

 

Edit: that would also mean more ordered approach to how we use sounds in our maps. Things like adding music in a speaker and setting it to s_global 1 would be considered a hack, and not the usual workflow.


Edited by Judith, 04 December 2017 - 03:31 AM.


#11 Destined

Destined

    Advanced Member

  • Member
  • PipPipPip
  • 1318 posts

Posted 04 December 2017 - 08:19 AM

No. EFX is an external, third-party system for modeling reverb, and that applies to everything in a 3d space. Game menu is considered 2d so EFX doesn't apply to it. My guess is that we need some kind of invisible gui/windowDef in game that would play "2d sounds" like music, player monologue, player grunts and UI sounds. Thief 3 system wasn't bad in that regard.

Too bad :(

 

 

IMO, from player perspective, we need more self-explanatory system, i.e. channels, and volume sliders like Music, SFX, Speech, and Video. E.g. (as in Dishonored 2):

 

 

So in a long run, we'd have sound channels for playing and adjusting the volume properly, and on another level, distnction between 2d and 3d for EFX.

I guess there's no way around it, it will be a pain in the ass to make it work :/

I agree. However, it will be difficult to not break older missions, if any sound definitions get changed. Maybe some system would be possible that allows for a spawnarg that defines sounds as 2D or 3D, and causes sounds to be either sent through GUI (for 2D) or not (for 3D). If this is set to 2D by default, missions without EFX would not be affected, but later missions can use the system. I want to stress that I have no idea if/how this is possible from a coding point of view. I am just brainstorming how the system might work without affecting older missions.

 

Redefining the sound sliders for a more intuitive system would be great, but again, this might break missions or would require to update the speakers of older missions. I fear this will not be easy to achieve without compromising older missions. On the other hand, depending on how thorough the mappers themselves have worked so far, it is possible that many sounds were set up in a "workaround style" like you described and do also not work too well with the current slider setting. I have not played around with the sliders too much, so I can't really tell...


  • Springheel likes this

#12 Springheel

Springheel

    Creative Director (retired)

  • Admin
  • 36631 posts

Posted 04 December 2017 - 08:43 AM

I agree that the sound system is a bit of a mess, but there's a limit to what we can do that wouldn't require updating 100+ missions.

 

As far as the EFX issue goes, I like Demagogue's suggestion.  Is it possible to limit EFX by file name, or folder name (as all our ambient music is in a single folder)?


  • Judith likes this

#13 Judith

Judith

    Advanced Member

  • Member
  • PipPipPip
  • 762 posts

Posted 04 December 2017 - 08:48 AM

IMO older missions won't be affected, because they don't use EFX system at all, and it only affects sounds placed in map.

 

So actually the opposite would be better: all sounds should be set to 3d by default. That's because the subset of sounds needed to be labelled as 2d is much smaller: player VO, player grunts (hmm.. not sure about this one), UI sounds, background music for the location system — that's basically it.

 

I agree that channels and sliders are more broad perspective and it should be left as is right now; let's work within more reasonable scope.


Edited by Judith, 04 December 2017 - 09:28 AM.

  • stgatilov likes this

#14 stgatilov

stgatilov

    Advanced Member

  • Development Role
  • PipPipPip
  • 517 posts

Posted 04 December 2017 - 09:34 AM

The menu sounds are not affected because they live in separate idSoundWordLocal. So their sounds are completely independent.

All the rest is affected by EFX.

If does not matter whether sound is spatialized (i.e. has 3d location) or not (i.e. is just ambient thing without location): weapon sheathing is not spatialized, but it is still affected by EFX.

 

It is not hard to selectively disable EFX for some sounds.

At the moment where we need to decide whether to apply EFX effect or not (see the code snippet above), we have access to:

  • idSoundChannel
  • idSoundShader: all parameters (min/max distance, volume, shakes, soundShaderFlags, soundClass), shader filename, even description (e.g. "Made by comp-music"), 
  • idSoundSample (the one being played + all described in sound shader): filename, format, size, whatever.

We can set any rules we want there --- there is no technical problem.

As a proof, I have disabled EFX on all non-spatialized sounds in svn rev 7333. But I'm not sure that it is a good idea.

 


  • Judith, nbohr1more and Anderson like this

#15 stgatilov

stgatilov

    Advanced Member

  • Development Role
  • PipPipPip
  • 517 posts

Posted 04 December 2017 - 09:48 AM

There are several possibilities for EFX setting:
 

 

1. Mark sound shader which must not be affected with special "soundClass".

soundClass is already parsed by TDM.

Here is description about sound classes (only classes 0, 1, 2, and 3 are possible now):

// sound classes are used to fade most sounds down inside cinematics, leaving dialog
// flagged with a non-zero class full volume
const int SOUND_MAX_CLASSES = 4;

2. Set a flag in sound shader of existing type.

Here is the list of all flags currently parsed by sound shader:

  • no_dups
  • no_flicker
  • looping
  • no_occlusion
  • private
  • antiPrivate
  • playonce
  • global
  • unclamped
  • omnidirectional

 

3. Add a new flag, which we would set in sound shader to disable EFX effects on sounds.

Just invent a name for this flag (different from existing ones), and I'll add it --- that's simple.

 


  • Judith, HMart and Anderson like this

#16 Judith

Judith

    Advanced Member

  • Member
  • PipPipPip
  • 762 posts

Posted 04 December 2017 - 09:56 AM

That's awesome. Possibly something short to type, like efxoff?


  • nbohr1more likes this

#17 Abusimplea

Abusimplea

    Member

  • Member
  • PipPip
  • 181 posts

Posted 04 December 2017 - 12:04 PM

That's awesome. Possibly something short to type, like efxoff?

That would be called "no_efx" if i extracted the naming convention from the list correctly.


  • stgatilov likes this

#18 Judith

Judith

    Advanced Member

  • Member
  • PipPipPip
  • 762 posts

Posted 04 December 2017 - 12:12 PM

Apparently I'm out of likes already, but yeah, that makes sense :)



#19 stgatilov

stgatilov

    Advanced Member

  • Development Role
  • PipPipPip
  • 517 posts

Posted 04 December 2017 - 12:30 PM

Unless there are any objections, I'll implement support for no_efx flag in sound shader (tomorrow).

I'll commit it to SVN.

After that someone has to review existing sound shaders and set the flag where appropriate.


  • Judith, HMart, Anderson and 1 other like this

#20 Judith

Judith

    Advanced Member

  • Member
  • PipPipPip
  • 762 posts

Posted 04 December 2017 - 01:22 PM

IMO all sounds from:

tdm_sfx_game

tdm_ambient_ambience_zoned

tdm_ambient_ambience_zoned02

 

Also tdm_sfx_thunder, as those are pretty loud and have their own reverb, so we don't blow up people's eardrums with these ;)

 

There's also the question of player grunts in tdm_player. At least some of these should be excluded from EFX too. Maybe the "quiet" ones, like food crunches, heartbeat, mantle, rustle, crouch, pickup_body, hmm, drink_potion, drown?



#21 Abusimplea

Abusimplea

    Member

  • Member
  • PipPip
  • 181 posts

Posted 04 December 2017 - 05:44 PM

Regarding player grunts: If they are internal (heart beat, eating, drinking...) they probably should indeed be no_efx. But external ones like shouldering bodies or movement sounds should be affected by EFX. Though they might need some polish if they end up too present.



#22 demagogue

demagogue

    Mod hero

  • Active Developer
  • PipPipPipPipPip
  • 5254 posts

Posted 04 December 2017 - 06:39 PM

IIRC some of the ambients are actually in-world sounds, like wind or distant chatter, etc. In-world sounds should still be subject to EFX.

 

Some could be ambiguous, in world or out of world, like hums or ambients that also play natural sounds, or you know a mapper might have one playing on a record player. But I suppose in these cases, if the player wants to override the default no_EFX settings they can just set it to "0" on their soundshader or location entity.


Posted Image

#23 stgatilov

stgatilov

    Advanced Member

  • Development Role
  • PipPipPip
  • 517 posts

Posted 04 December 2017 - 07:56 PM

From theoretical perspective, each sound which is physically present in the game world and is emitted close to the player must be affected by EFX.

The following things should not be affected: the internal "thoughts" of the player, in-head player sounds, generic ambients, menu + inventory + objective sounds, probably even distant sounds like storm.

The following things should be affected: weapon unsheathing, probably rats sounds + every sound which may be heard by guards.

 

As for body shouldering sound, we have to decide if it is in-head sound or not.

If it is not heard by guards, then it would be more logical to consider it "in-head" or "helper" sound and exlude it from EFX.

EDIT: listened to shouldering sound, it seems to be a technical thing (like inventory sounds), not a physically present sound.

 

As for weapon switching, I'm not sure if this is a real sound in the world, or just a "helper" sound to tell player that the weapon is changed.



#24 Springheel

Springheel

    Creative Director (retired)

  • Admin
  • 36631 posts

Posted 04 December 2017 - 08:48 PM

Weapon switching or inventory sounds (like drinking a potion or dropping a flashbomb) should be affected by EFX.

 

The rustling sound of shouldering a body should be affected by EFX.  The "uh-uh" sound when the player cannot drop a body should not be, as it would be in the player's head.



#25 stgatilov

stgatilov

    Advanced Member

  • Development Role
  • PipPipPip
  • 517 posts

Posted 04 December 2017 - 09:05 PM

Added support for "no_efx" keyword in SVN rev 7337, binaries updated in SVN rev 15109.

 

Everything is ready for the sound shaders review.

Recall that you can type "reloadDecls" in TDM console to update sound shaders without reloading TDM.

 

Theoretically, the engine allows overriding some sound properties on sound emitter by setting spawn args (e.g. s_volume or s_omni).

I did not change anything there, so it is currently not possible to override no_efx setting.

Even if I add support, it would be one-way: spawnarg can turn EFX-affected sounds into no_efx sounds, but not vice versa.

 





Reply to this topic



  


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users