x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

how does the NEW audio occlusion in 4.11 work exactly?

So, i really want to use the audio occlusion feature, but i think i am misinterpreting what the line of sight within the description really means for this feature?? I have an ambient sound cue that has the enable occlusion on, this soundcue sits in a large room that can be enter either from top or bottom, when i am flying around in the editor and i have realtime audio at full volume, the audio occlusion feature works exactly as i expect it. Once i am behind a door, i hear it occluded and when i enter the room, i can hear the filter open up. but when i play in the editor, its the opposite? Also, if i enter the room while looking at the sound source direction i'll hear it occluded but if i turn around i won't? so i find it bizarre that the feature seems to work while in the edit but when i play test its off. i made sure not to have sound focus on, just in case that was causing a non-focus attenuation problem, which it isn't.

So my question is, why is my audio getting occluded when i look at the direction of the audio source but when i turn around i lose the occlusion? it is because of the "line of sight"? does the line of sight work from my camera (casting a linetrace) to an audio emitter and does it determine if something (with collision) is in between? because if that's the case, then something is really wrong. can someone please help me understand this feature better?

thanks so much in advance

Product Version: UE 4.11
Tags:
more ▼

asked Apr 14 '16 at 02:32 AM in Using UE4

avatar image

metalgunner87
0 1 2 4

avatar image Minus_Kelvin STAFF Apr 14 '16 at 05:58 PM

Are you playing with 3rd person camera when in-game? The occlusion feature currently only works from the listener position, not the character position, which is usually attached to the game viewport/camera. In 3rd person games, this can be a bit weird -- I suppose it's a reasonable feature addition to add the option to perform the trace from the position of the player controller/pawn rather than from the listener position (or viewport position).

I recently added the ability (4.12 feature) for users to define their own trace channel to use (it's currently using Visibility) so you can more tightly control what geometry causes audio occlusion.

avatar image metalgunner87 Apr 14 '16 at 07:56 PM

Thanks for the reply, well yes and no actually, we do have a 3rd person camera but also a 1st person camera. we can choose which view we want by pressing V. so i am wondering if by having a 3rd person camera behind my character and although i am using the 1st person camera (inside our ship), its default the listener position to the 3rd person camera?? maybe i'll try removing the 3rd person camera altogether and see if that does the trick, but if it doesn't do you suggest another work around?? and yes it would be a great feature if we can choose where does the trace start or from what camera we can choose to have the listener position be.

avatar image Minus_Kelvin STAFF Apr 14 '16 at 09:31 PM

Unfortunately, there isn't a work around without modifying code at the moment. However, it would be pretty straightforward to experiment with doing the trace from a player controller's pawn. If you want to modify the source to try it out, the place to do it would be FActiveSound::CheckOcclusion.

         // Default trace location is the listener location
         FVector TraceLocation = ListenerLocation;
 
         // Temporary branch -- would probably add this as a flag to the AttenuationSettingsPtr object
         bool bUsePlayerPawnForTraceLocation = true;
         if (bUsePlayerPawnForTraceLocation)
         {
             // Get the player controller pawn if it exists and override the trace location
             if (APlayerController* PlayerController = UGameplayStatics::GetPlayerController(WorldPtr, 0))
             {
                 if (APawn* PlayerPawn = PlayerController->GetPawn())
                 {
                     TraceLocation = PlayerPawn->GetActorLocation();
                 }
             }
         }
 
         if (bOcclusionAsyncTrace)
         {
             WorldPtr->AsyncLineTraceByChannel(SoundLocation, TraceLocation, ECC_Visibility, Params, FCollisionResponseParams::DefaultResponseParam, &OcclusionTraceDelegate);
         }
         else
         {
             bIsOccluded = WorldPtr->LineTraceTestByChannel(SoundLocation, TraceLocation, ECC_Visibility, Params);
         }


I just threw this code together and tested it this afternoon and it appears to work pretty well in the case of a 3rd person camera (i.e. sounds are still occluded behind a barrier if camera can see but actor pawn can't). We just missed the feature deadline for 4.12 but I will try and see if I can add something like this for 4.13.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

0 answers: sort voted first
Be the first one to answer this question
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question