Wwise Version
arrow_right Table of Contents
Wwise SDK 2021.1.2
Raytracing Engine Geometry Guide

Introduction

Raytracing is a technique for efficiently evaluating nth-order reflection and diffraction. The basic idea is to randomly cast rays from the listener and follow their paths through a series of reflections and diffraction. The technique is inspired by graphic rendering techniques. The current implementation supports up to 4th order of reflection and diffraction on the listener and emitter sides.

Concepts

  • Primary rays: the rays directly cast from the listener
  • Reflection: bouncing of sound on surfaces
  • Diffraction: bending of sound around objects
  • Paths: series of reflections/diffractions from the listener to an emitter
  • Emitter receptor: bounding box or bounding sphere centered around an emitter

Settings

  • Number of Primary Rays (uNumberOfPrimaryRays): The number of rays cast from the listener. Increasing the number of primary rays gives better results but costs more CPU time. The default value is usually good for most applications.
  • Maximum Reflection Order (uMaxReflectionOrder): The maximum number of times the ray will successively bounce off surfaces. Increasing the maximum order of reflection leads to a more detailed acoustic simulation but can highly impact the CPU performance.
  • Direct Diffraction Path (bEnableGeometricDiffractionAndTransmission): A direct diffraction path between the listener and an emitter is a path composed exclusively of diffraction segments. Enabling direct diffraction path computation increases significantly the CPU cost.
  • Diffraction on Reflections (bEnableDiffractionOnReflection): Enables diffraction at the beginning and the end of a reflection path (a path composed only of reflection segments). Enabling diffraction on reflections prevents the simulation to unexpectedly drop reflections when the emitter or the listener moves behind an obstacle. As with direct diffraction path, it significantly increases the CPU cost.
  • Maximum Path Length (fMaxPathLength): Maximum length of a path segment. High values compute longer paths but increase the CPU cost.
  • CPU Limit Mode (bEnableCPULimitMode): If enabled, the raytracing engine automatically limits the number of primary rays to ensure CPU usage remains around the CPU Limit Percentage.
  • CPU Limit Percentage (fCPULimitPercentage): The target percentage (expressed as a percentage of an audio frame) used by the raytracing engine to compute reflections and diffractions.

CPU Limit Mode

Tweaking the number of primary rays can be tricky as it depends on the complexity of the scene (number of triangles, number of diffraction edges...) and the number of emitters. When CPU Limit Mode is active, the raytracing engine automatically adapts the number of primary rays to ensure CPU usage remains around the target value defined by the user. Although this mode minimizes peaks in CPU usage it cannot completely remove short and sudden peaks. Setting a high target value increases quality (number of reflection and diffraction paths found) at the cost of performance. While setting a low target value increases performance at the cost of quality. When CPU Limit Mode is active, the number of primary rays is capped at 500. When the number of primary rays drops down to 0, the raytracing engine stops scanning the environment. However the existing sound propagation paths are still validated and updated. As a consequence, the raytracing engine still consumes CPU.

Limitations

There are a few limitations when defining geometries for the raytracing engine. The limitations concern both the performance and the quality of the results.

Geometry visible angle

When a triangle is smaller than the sampling density, the raytracing engine is less likely to find it.

The geometry's visible angle alpha is the angle at which the geometry is seen from the point of view of the listener. Depending on the number of primary rays, the average angle (gamma) between two rays varies. The relation between alpha and gamma influences the probability of finding an intersection (a reflection or a diffraction) with the object. If gamma is smaller than alpha, the probability of finding an intersection is high. If gamma is bigger than alpha, the probability of finding an intersection is low.

In this example, gamma is smaller than alpha. Hence, the probability of finding an intersection with the object is high.
In this example, alpha is smaller than gamma. Hence, the probability of finding an intersection with the object is low.

Number of triangles

The number of triangles contained in the geometry is directly related to the CPU usage of the engine: the more triangles, the higher the CPU usage. This is due to the fact that more intersection tests are required on the object. Usually, sound propagation does not require highly detailed geometry. Reducing the number of triangles can help increase the performance without sacrificing quality.

Here the plane is composed of 4 triangles: the rays have to be tested against each triangle.

Geometry shape

Some geometry shapes are more difficult to process than others. Usually, geometries like planes and boxes are simple to process and give the best results in terms of sound propagation. Spheres and cylinders are more prone to errors. This is due to the curvature introduced by the sphere and the cylinder. Some diffraction edges may not be found, which would cause some diffraction paths to be missed. The algorithm implements several heuristics to overcome this issue in most cases. Increasing the number of primary rays or simplifying the geometry can solve the issue as well.

In this situation, we expect to find the diffraction path from L to E that goes through L, E2, E3, E4, and E. Unfortunately, the surface between E1 and E2 is small and thus it is difficult to find the necessary intersection that will provide the diffraction edge E2. In this case, the intersection with E1 is more likely. L is not in the shadow zone of E1, preventing the algorithm from actually finding the diffraction path from E2.