VIEW COHERENCE IN RAY TRACINGcs.uccs.edu/~gsc/pub/master/cwolfe2/doc/Tom Wolfe Thesis.d… · Web...

99
ACOUSTIC MODELING OF REVERBERATION USING SMOOTHED PARTICLE HYDRODYNAMICS by Charles Thomas Wolfe B.A., Marshall University, 2004 A thesis submitted to the Graduate Faculty of the University of Colorado at Colorado Springs in partial fulfillment of the requirements for the degree of Master of Science Department of Computer Science 2007

Transcript of VIEW COHERENCE IN RAY TRACINGcs.uccs.edu/~gsc/pub/master/cwolfe2/doc/Tom Wolfe Thesis.d… · Web...

Page 1: VIEW COHERENCE IN RAY TRACINGcs.uccs.edu/~gsc/pub/master/cwolfe2/doc/Tom Wolfe Thesis.d… · Web viewThe equation that determines the force acting on given volume of incompressible

ACOUSTIC MODELING OF REVERBERATION

USING SMOOTHED PARTICLE

HYDRODYNAMICS

by

Charles Thomas Wolfe

B.A., Marshall University, 2004

A thesis submitted to the Graduate Faculty of the

University of Colorado at Colorado Springs

in partial fulfillment of the

requirements for the degree of

Master of Science

Department of Computer Science

2007

Page 2: VIEW COHERENCE IN RAY TRACINGcs.uccs.edu/~gsc/pub/master/cwolfe2/doc/Tom Wolfe Thesis.d… · Web viewThe equation that determines the force acting on given volume of incompressible

This thesis for the Master of Science degree by

Charles Thomas Wolfe

has been approved for the

Department of Computer Science

by

____________________________________Sudhanshu K. Semwal, Chair

____________________________________C. H. Edward Chow

____________________________________Jason A. Roney

__________Date

Page 3: VIEW COHERENCE IN RAY TRACINGcs.uccs.edu/~gsc/pub/master/cwolfe2/doc/Tom Wolfe Thesis.d… · Web viewThe equation that determines the force acting on given volume of incompressible

Wolfe, Charles Thomas (M.S., Computer Science)

Acoustic Modeling of Reverberation Using Smoothed Particle Hydrodynamics

Thesis directed by Professor Sudhanshu K. Semwal

Current methods for digital acoustic modeling of reverberation can be

categorized into two main areas: DSP algorithms and sound tracing algorithms. DSP

algorithms are usually chosen for their speed and ease of use. They simulate

reverberation by creating thousands of echoes of the original signal and mixing these

echoes back into the original signal [WHIT01]. DSP methods are generally fast, but

do not accurately represent complex environments. Sound tracing algorithms, such as

beam tracing, accurately model static environments by using a modified ray-tracing

algorithm to trace out “beams” of sound and compute their reflection and decay

properties [FUNK98]. These algorithms accurately model static, geometrically

simple environments, but have difficulty with complex and/or moving geometry.

A Computation Fluid Dynamics (CFD) method called Smoothed Particle

Hydrodynamics (SPH) has recently gained interest as a method for accurately

simulating fluid flow using discrete particles [LIU03]. This thesis extends earlier

work on SPH by adding the ability to model sound wave propagation through fluids.

A generalized method that integrates sound generation and reception is presented,

providing a basis for acoustic sound effects, such as reverberation. The algorithms

were implemented in standard C++ using Standard Template Library objects.

Page 4: VIEW COHERENCE IN RAY TRACINGcs.uccs.edu/~gsc/pub/master/cwolfe2/doc/Tom Wolfe Thesis.d… · Web viewThe equation that determines the force acting on given volume of incompressible

CONTENTS

CHAPTER

INTRODUCTION......................................................................................................1

PREVIOUS WORK.................................................................................................3

Acoustic Modeling of Reverberation.................................................................3

Physical Methods..........................................................................................3

DSP Methods................................................................................................4

Sound Tracing Methods................................................................................4

Smoothed Particle Hydrodynamics....................................................................5

SPH Theory...................................................................................................5

Application..................................................................................................12

NEW ALGORITHM DESIGNS...........................................................................17

SPH Acoustic Modeling Simulation................................................................17

Initialization................................................................................................17

Simulation – Stage 1...................................................................................18

Simulation – Stage 2...................................................................................18

New Sound Emitter Algorithm........................................................................19

New Sound Receiver Algorithm......................................................................20

IMPLEMENTATION............................................................................................21

Overview of Class Hierarchy...........................................................................21

Class SPHSimulator.........................................................................................22

Page 5: VIEW COHERENCE IN RAY TRACINGcs.uccs.edu/~gsc/pub/master/cwolfe2/doc/Tom Wolfe Thesis.d… · Web viewThe equation that determines the force acting on given volume of incompressible

v

Class SPHParticle............................................................................................24

Class SPHKernel and Derivatives...................................................................24

Classes SPHGrid and SPHGridCell.................................................................25

Class SPHBoundary and Derivatives...............................................................26

Class SPHSoundEmitter..................................................................................26

Class SPHSoundReceiver................................................................................27

Class WAVFile................................................................................................28

Class Camera...................................................................................................28

RESULTS................................................................................................................29

Simulation Setup..............................................................................................29

Simulation Results...........................................................................................30

Scene File 1.................................................................................................33

Scene File 2.................................................................................................37

Scene File 3.................................................................................................39

Scene File 4.................................................................................................42

Scene File #5...............................................................................................44

Scene File #6...............................................................................................47

Scene File #7...............................................................................................49

Scene Files #8 through #20.........................................................................52

Results Conclusion...........................................................................................52

FUTURE WORK....................................................................................................53

Accuracy of Reverberation..............................................................................53

Acoustic Modeling...........................................................................................54

Page 6: VIEW COHERENCE IN RAY TRACINGcs.uccs.edu/~gsc/pub/master/cwolfe2/doc/Tom Wolfe Thesis.d… · Web viewThe equation that determines the force acting on given volume of incompressible

vi

CONCLUSION.......................................................................................................55

BIBLIOGRAPHY....................................................................................................56

Page 7: VIEW COHERENCE IN RAY TRACINGcs.uccs.edu/~gsc/pub/master/cwolfe2/doc/Tom Wolfe Thesis.d… · Web viewThe equation that determines the force acting on given volume of incompressible

vii

TABLES

Table 1: Scene file variable settings for scene file #1.................................................33

Page 8: VIEW COHERENCE IN RAY TRACINGcs.uccs.edu/~gsc/pub/master/cwolfe2/doc/Tom Wolfe Thesis.d… · Web viewThe equation that determines the force acting on given volume of incompressible

viii

FIGURES

Figure 1: Eulerian based method...................................................................................6

Figure 2: Lagrangian method.........................................................................................6

Figure 3: Three kernels taken with h =1......................................................................12

Figure 4: SPH Acoustic Simulation Class Hierarchy..................................................22

Figure 5: Time and domain graph of “dry” impulse WAV.........................................31

Figure 6: Frequency domain graph of “dry” impulse WAV.......................................31

Figure 7: Time domain graph of “dry” piano melody WAV.......................................32

Figure 8: Frequency domain graph of “dry” piano melody WAV..............................32

Figure 9: Time domain graph of impulse WAV from scene file #1............................34

Figure 10: Frequency domain graph of impulse WAV from scene file #1.................35

Figure 11: Time domain graph of piano melody WAV from scene file #1................36

Figure 12: Frequency domain graph of piano melody WAV from scene file #1........36

Figure 13: Time domain graph of impulse WAV from scene file #2..........................37

Figure 14: Frequency domain graph of impulse WAV from scene file #2.................38

Figure 15: Time domain graph of piano melody WAV from scene file #2................38

Figure 16: Frequency domain graph of piano melody WAV from scene file #2........39

Figure 17: Time domain graph of impulse WAV from scene file #3..........................40

Figure 18: Frequency domain graph of impulse WAV from scene file #3.................40

Figure 19: Time domain graph of piano melody WAV from scene file #3................41

Figure 20: Frequency domain graph of piano melody WAV from scene file #3........41

Figure 21: Time domain graph of impulse WAV from scene file #4..........................42

Page 9: VIEW COHERENCE IN RAY TRACINGcs.uccs.edu/~gsc/pub/master/cwolfe2/doc/Tom Wolfe Thesis.d… · Web viewThe equation that determines the force acting on given volume of incompressible

ix

Figure 22: Frequency domain graph of impulse WAV from scene file #4.................43

Figure 23: Time domain graph of piano melody WAV from scene file #4................43

Figure 24: Frequency domain graph of piano melody WAV from scene file #4........44

Figure 25: Time domain graph of impulse WAV from scene file #5..........................45

Figure 26: Frequency domain graph of impulse WAV from scene file #5.................45

Figure 27: Time domain graph of piano melody WAV from scene file #5................46

Figure 28: Frequency domain graph of piano melody WAV from scene file #5........46

Figure 29: Time domain graph of impulse WAV from scene file #6..........................47

Figure 30: Frequency domain graph of impulse WAV from scene file #6.................48

Figure 31: Time domain graph of piano melody WAV from scene file #6................48

Figure 32: Frequency domain graph of piano melody WAV from scene file #6........49

Figure 33: Time domain graph of impulse WAV from scene file #7..........................50

Figure 34: Frequency domain graph of impulse WAV from scene file #7.................50

Figure 35: Time domain graph of piano melody WAV from scene file #7................51

Figure 36: Frequency domain graph of piano melody WAV from scene file #7........51

Page 10: VIEW COHERENCE IN RAY TRACINGcs.uccs.edu/~gsc/pub/master/cwolfe2/doc/Tom Wolfe Thesis.d… · Web viewThe equation that determines the force acting on given volume of incompressible

CHAPTER I

INTRODUCTION

Reverberation is a natural property of enclosed spaces in which a sound

continues to echo after the sound source has been removed. In these spaces, sound

travels outward from the sound source and interacts with walls, floors, ceilings or any

other obstacle. Part of the sound is absorbed and converted to thermal energy, while

part of the sound is refracted and continues to travel through the obstacle material.

The vast majority of the sound energy, however, is reflected. When a large number

of reflections return back to the listener, the effect is called reverberation.

The music industry in particular has been interested in artificial reverberation

for years. Using various methods, the music industry has included reverberation on

most every recording since the early 1900’s. Early methods, such as plate reverb,

focused on using physical objects that resonated according to a sound source placed

near them. With the development of electronic technology in the latter part of 20 th

century, digital signal processing methods are preferred for most current music

production, due to their ease of use and easy portability. No longer does a musician

or sound engineer have to set up a bulky reverb effect or record in a specialized

reverb chamber. The sound is processed electronically after the original sound has

been recorded. In addition to DSP, other acoustic modeling methods, such as sound

Page 11: VIEW COHERENCE IN RAY TRACINGcs.uccs.edu/~gsc/pub/master/cwolfe2/doc/Tom Wolfe Thesis.d… · Web viewThe equation that determines the force acting on given volume of incompressible

2

tracing, have experienced some success due to their ability to accurately simulate

complex environments [FUNK98].

Although DSP methods are the current preferred method, they are by no

means perfect. The primary restriction on these methods is that they rely on sound

engineers recording the reverberation pattern of a given environment. This means for

a given reverberation pattern, a room must be constructed, recorded and transformed

into a DSP model. The algorithms presented in this thesis make an attempt to

eliminate the need for this kind of setup. Using a newly developed fluid mechanics

simulation algorithm, Smoothed Particle Hydrodynamics, complex acoustic

environments can be simulated in software, allowing sound engineers the ability to

model any kind of room, hall or cathedral type setting. The new algorithms were

tested using two sounds: an acoustic engineering type, the impulse, and a short

musical phrase sound for a real-world application.

Chapter II discusses the history of reverberation simulation, and also gives a

brief introduction to the history and theory of the Smoothed Particle Hydrodynamics

algorithm. Chapter III describes the new algorithms used for simulation of sound

emission and reception and how they integrate into the general SPH solver. Chapter

IV describes the implementation of the C++ acoustic reverb simulation. Chapter V

discusses the results, both positive and negative, for the simulation tests that were

performed. Chapter VI contains ideas for future tweaking and application

possibilities. Chapter VII is the thesis summary and conclusion.

Page 12: VIEW COHERENCE IN RAY TRACINGcs.uccs.edu/~gsc/pub/master/cwolfe2/doc/Tom Wolfe Thesis.d… · Web viewThe equation that determines the force acting on given volume of incompressible

CHAPTER II

PREVIOUS WORK

Acoustic Modeling of Reverberation

Physical Methods

There are three main methods for adding a reverberation effect to an existing

sound: chamber reverberators, plate reverberators and spring reverberators. A

chamber reverberator uses a physical room to produce the effect. A loudspeaker

placed in the room would provide the sound source, while a microphone placed in the

room would pick up the sound source and the resulting echoes from the chamber.

The captured sound would then be mixed back into the source sound for the desired

effect. Plate reverberators employ a large metal plate, which contains an

electromechanical transducer, similar to the voice coil in a loudspeaker. A magnetic

pickup records the plate’s vibrations and the resulting sound is then mixed with the

original source. A spring reverb contains an electromechanical transducer on one end

of a spring and a magnetic pickup on the other end. The vibrations induced in the

spring from the transducer are recorded by the pickup, which is then mixed with the

original source. Spring reverbs are sometimes included in guitar amplifiers since

their small size and cost allow them to be easily incorporated into the small amp

enclosures.

Page 13: VIEW COHERENCE IN RAY TRACINGcs.uccs.edu/~gsc/pub/master/cwolfe2/doc/Tom Wolfe Thesis.d… · Web viewThe equation that determines the force acting on given volume of incompressible

4

DSP Methods

With the invention of digital signal processing, fast and easy approximation

of reverberation has become a reality. Since reverberation is just reflections of a

sound source, DSP algorithms copy the original sound thousands of times and mix

them in using delay with the original signal. The primary ingredient in DSP reverb

algorithms is the arrival time gap, or the time it takes for the first reflected sound to

reach the ear. This is what lets the ear know how large the environment is (a longer

the delay time signifies a larger space).

Sound Tracing Methods

Sound tracing has recently gained attention in acoustic modeling and

reverberation as computing power has increased to the point where these algorithms

are feasible [FUNK98]. Sound tracing is an adaptation of familiar ray tracing

methods. As sound and light are both wave phenomena, standard computer graphics

algorithms used to trace light rays (or beams) have been modified to work with sound

waves. Significant differences exist however, such as the difference in speed between

light and sound. The result of these differences causes sound to be treated differently

than light in ray tracing algorithms. For example, significant ranges of arrival times

occur from sound traveling along different paths (direct or reflected) as the sound

speed is significantly slower that light. Thus, it is important to compute precisely the

exact time and frequency distribution of sound arriving via reflected paths. One

Page 14: VIEW COHERENCE IN RAY TRACINGcs.uccs.edu/~gsc/pub/master/cwolfe2/doc/Tom Wolfe Thesis.d… · Web viewThe equation that determines the force acting on given volume of incompressible

5

primary drawback with this method is that environments that are dynamic cannot be

efficiently modeled.

Smoothed Particle Hydrodynamics

SPH Theory

In Computational Fluid Dynamics, most current methods simulate the flow of

fluids using an Eulerian, or grid-based, method [LI64]. SPH, however, is particle-

based and therefore utilizes a Lagrangian approach. In an Eulerian simulation, field

values are defined only on regularly spaced grid points. The flow of fluid is observed

flowing past fixed points in space. This method is well suited for simulation where

flow past a point must be observed, such as the end of a pipe. The grid-based method

is especially well-suited using data structures such as cellular automata, but the

method does come with drawbacks. First, the fluid is confined to the grid and the

flow is undefined outside of the grid. Second, if the grid is large, the data set may

only use a small portion of the grid and memory is wasted if the fluid never flows into

other portions of the grid. Third, if the fluid particles are to interact with solid

objects, the grid resolution may need to be increased to achieve the desired fluid

motion. Figure 1 shows the evaluation of field variables using an Eulerian method.

An alternative to the grid-based method above is to use discrete fluid

elements, or particles, to represent the fluid [LUCY77]. This gives the benefit of only

having to calculate interactions between a finite set of elements and no memory space

is wasted on storing field data in locations the fluid may never visit. One downside to

Page 15: VIEW COHERENCE IN RAY TRACINGcs.uccs.edu/~gsc/pub/master/cwolfe2/doc/Tom Wolfe Thesis.d… · Web viewThe equation that determines the force acting on given volume of incompressible

6

this approach is the inherent error in creating a vector field from a weighted

contribution of a finite set of particles. Increasing the number of particles can reduce

the error, but this also increases the computation time and memory requirements.

Figure 2 shows the evaluation of field variables using a Lagrangian approach.

Figure 1: Eulerian based method. Arbitrary points are interpolated from grid points.

Figure 2: Lagrangian method. Arbitrary points are interpolated from a weighted average of particles

within a certain distance from the point.

SPH was created independently in 1977 by Lucy and Monaghan to model

astrophysical phenomena [MONA77]. However, the method is general enough to

apply to any area of fluid dynamics and has even been used to simulate highly

deformable elastic bodies [DESB96]. The central concept of SPH is the use of a

smoothing kernel, a function that “smoothes out” the field variables of the particles,

and increases the spatial extent of the particles. This kernel is applied to the Navier-

Stokes momentum equation, the continuity equation and a state equation. Thus, a

field variable of a particle is calculated from a weighted contribution of all particles

Page 16: VIEW COHERENCE IN RAY TRACINGcs.uccs.edu/~gsc/pub/master/cwolfe2/doc/Tom Wolfe Thesis.d… · Web viewThe equation that determines the force acting on given volume of incompressible

7

surrounding it. The smoothing length, h, determines the spatial extent of the kernel

and therefore what particles are included in the contribution.

To evaluate the value of a field variable, such as density or pressure in SPH, a

smoothed average is calculated according to the following integral interpolant:

Eq. 1

where is the field variable, is the smoothed average, and W is the

smoothing kernel [CASH02]. The smoothing length, h, determines the particles that

are used for the interpolation. In discrete simulations, the smoothed average of the

field variable can be approximated by summations. SPH uses the concept of a Monte

Carlo summation, where points are randomly distributed throughout the fluid. Thus,

the probability of finding one of the points in the volume element centered around

the point is proportional to . Then, the smoothed average can be

approximated by the summation:

Eq. 2

where is the mass of the point, is the density at the position of the point,

is the value of the field variable being approximated at . One of the advantages

of this method is the ease in calculating the spatial derivatives of field variables, such

as gradients. For equations involving the gradient of a field variable, only the

gradient of the smoothing kernel needs to be evaluated, so that:

. Eq. 3

The Laplacian can be calculated similarly:

Page 17: VIEW COHERENCE IN RAY TRACINGcs.uccs.edu/~gsc/pub/master/cwolfe2/doc/Tom Wolfe Thesis.d… · Web viewThe equation that determines the force acting on given volume of incompressible

8

. Eq. 4

To simulate the flow of a fluid, equations that describe the motion of the fluid

must be evaluated. The equation that determines the force acting on given volume of

incompressible fluid is the Navier-Stokes equation for incompressible fluids:

Eq. 5

where is the velocity, P is the pressure, or body force and v is the

kinematic viscosity. The kinematic viscosity is defined as:

. Eq. 6

where is the dynamic viscosity of the fluid. Equation 5 can be split into three

distinct forces: , the force due to the pressure gradient, , the viscous

force, and , the total force of external influences acting on the fluid. The SPH

formulations of these forces are listed below. To calculate the force on a particle i

due to the pressure gradient, the following SPH equation is used:

. Eq. 7

There is a problem, however: the forces between the particles are not symmetrical.

Therefore, the following equation that uses the average pressure between the particles

has been proposed [LIU03]:

. Eq. 8

To calculate the viscous force, we use the following equation:

Page 18: VIEW COHERENCE IN RAY TRACINGcs.uccs.edu/~gsc/pub/master/cwolfe2/doc/Tom Wolfe Thesis.d… · Web viewThe equation that determines the force acting on given volume of incompressible

9

. Eq. 9

The general viscous term in Equation 9 is defined as:

. Eq. 10

where , , is the average density of particles i and j, is the

mean speed of sound, and . For simulation of water, is

usually taken in the range 0.1 – 0.01, and [9]. In addition to

Equations 9 and 10 above, another form of the viscous force equation has been

suggested by Müller [MÜLL03]. The external forces, such as gravity, do not depend

on the SPH formulation and are just added to the pressure and viscous forces. In

order to calculate the force equations above, the density must be calculated at every

time step by Equation 11:

. Eq. 11

Unfortunately, for free surface flows, the density will be incorrectly low for

surface particles, since there are no particles beyond the surface to be included in the

density calculation. Monaghan suggests the following method for density

calculations [MONA94]. First, all particles are assigned an initial density (usually

1000 kg / m3 for water) and the density only changes when the particles are in relative

motion. The rate of change of density for a particle i then becomes:

Page 19: VIEW COHERENCE IN RAY TRACINGcs.uccs.edu/~gsc/pub/master/cwolfe2/doc/Tom Wolfe Thesis.d… · Web viewThe equation that determines the force acting on given volume of incompressible

10

. Eq. 12

An equation of state is also used to calculate the pressure of each particle during each

time step:

Eq. 13

where for water and is the initial density. The constant B determines the

speed that sound travels through the fluid. For a breaking dam simulation, the

following value for B is used [ROY95]:

Eq. 14

There are two criteria that smoothing kernels must meet [MONA92]:

and .

Thus, many different kernels can be created to satisfy certain conditions needed in a

given simulation. By far the most commonly used kernel is the kernel

[MONA92]:

Eq. 15

where . Desbrun suggests a “spiky” kernel for use in computing pressure

forces, as the kernel above tends to cause particles to cluster since the

gradient of the kernel approaches zero as particles move very close together

[DESB96]. The “spiky” kernel is defined in Equation 16 below.

Page 20: VIEW COHERENCE IN RAY TRACINGcs.uccs.edu/~gsc/pub/master/cwolfe2/doc/Tom Wolfe Thesis.d… · Web viewThe equation that determines the force acting on given volume of incompressible

11

Eq. 16

Using the standard kernel for the viscosity force calculation can cause the simulation

to become unstable if low numbers of particles are used, as they are in real-time

applications. To overcome this, Müller has suggested the following kernel for the

viscosity force calculation [MÜLL03]:

Eq. 17

The graphs of the three kernels, their gradients in the direction towards the center, and

the Laplacian of the viscosity kernel are shown in Figure 3 below.

a b c

0.5 1 1.5 2

0.1

0.2

0.3

0.4

0.2 0.4 0.6 0.8 1

2

4

6

8

10

12

14

0.2 0.4 0.6 0.8 1

5

10

15

20

25

Figure 3: Three kernels taken with h =1a) Monaghan’s Gaussian β-spline kernel; b) Desbrun’s spiky kernel; c) Müller’s viscosity kernel

(thick: kernel, thin: gradient in the direction towards the center, dashed: Laplacian)

Application

Page 21: VIEW COHERENCE IN RAY TRACINGcs.uccs.edu/~gsc/pub/master/cwolfe2/doc/Tom Wolfe Thesis.d… · Web viewThe equation that determines the force acting on given volume of incompressible

12

Although the theory behind SPH is straightforward, there are many details to

consider for a successful implementation of a general SPH solver, such as fixed and

variable smoothing lengths, symmetrization of particle interactions, adaptable time

steps and treatment of boundaries. The smoothing length, h, has a direct correlation

to a successful implementation of SPH. If h is too small, there may not be enough

neighbors in the support domain to exert forces on the particle of interest. However,

if h is too large, local properties of the fluid at the particle of interest may be overly

smoothed out, resulting in a low accuracy. The ideal number of neighboring particles

(including the particle itself) has been determined to be 5, 21 and 57 respectively for

1, 2 and 3 dimensions [LIU03]. Thus, depending on particle spacing and a scaling

factor k, the appropriate h can be determined in advance. For early implementations

of SPH, the smoothing length was fixed in space and time for the entire simulation.

In later implementations, an individual particle smoothing length was added to allow

for local variations in fluid contraction and expansion.

There are many ways to adapt the smoothing length to keep the number of

neighboring particles relatively constant. According to [LIU03], the simplest way to

evolve h over the simulation is by using the average and initial density:

Eq. 18

In Equation 18 above, is the initial smoothing length, is the initial density, is

the particle density and is the number of dimensions. Another method of

smoothing length evolution using the time derivative of the smoothing function has

been suggested:

Page 22: VIEW COHERENCE IN RAY TRACINGcs.uccs.edu/~gsc/pub/master/cwolfe2/doc/Tom Wolfe Thesis.d… · Web viewThe equation that determines the force acting on given volume of incompressible

13

Eq. 19

This equation can be discretized using the same method as the other SPH equations

such as density and pressure gradient and calculated with the other SPH equations in

parallel [LIU03].

If the smoothing length is forced to evolve in both time and space, interactions

between neighboring particles will not necessarily conform to Newton’s Third Law,

as each particle will have its own smoothing length. The following situation could

exist: particle i includes particle j in its sphere of influence, but not vice versa

(therefore, particle j would exert a force on i, but not i on j, in violation of Newton’s

Third Law). To overcome this inconsistency, several different methods have been

introduced, such as averaging the smoothing length of each of the particles, and also

taking the geometric mean.

Time integration plays an important role in providing both a stable and fast

simulation. The time step must be small enough to ensure that the Courant-

Friedrichs-Levy (CFL) condition is met; while not so small that the simulation is

computationally infeasible. The discrete SPH equations can be integrated using the

familiar Leap-Frog, predictor-corrector and Runge-Kutta methods. For each of these

methods, the time step must adhere to the CFL conditions above. To ensure this, the

time step is modified to be proportional to the smallest spatial particle resolution,

which in SPH is represented by the smallest smoothing length:

Eq. 20

Page 23: VIEW COHERENCE IN RAY TRACINGcs.uccs.edu/~gsc/pub/master/cwolfe2/doc/Tom Wolfe Thesis.d… · Web viewThe equation that determines the force acting on given volume of incompressible

14

where is the smoothing length for particle i, and is the speed of sound through

the fluid.

The treatment of boundaries has been of great interest since the development

of SPH. The symmetric nature of the smoothing kernel produces a particle deficiency

at the fluid boundary, as there are no particles on the other side of the boundary to

include in the density summation. Therefore, several methods exist that address this

problem, and the related issue of boundary penetration. There are generally three

ways to prohibit boundary penetration by the particles: collision detection and

response, force fields and virtual particles.

Standard collision detection techniques, such as point-plane intersections

work to keep the fluid particles from penetrating the boundary, but they are

problematic. For example, if a particle is reflected off of a boundary, the simulation

must also perform collision detection against all other boundaries after the collision

response. This can lead to costly, sometimes unnecessary computations. The

collision detection/response method also does not address the issue of particle

deficiency at the boundary.

Another method that seems to work better is to use a force field at the

boundary [AMA05]. During each time step, each particle in the fluid receives at

force component from every boundary. The force equation successfully prevents the

particle from penetrating the boundary:

Eq. 21

Page 24: VIEW COHERENCE IN RAY TRACINGcs.uccs.edu/~gsc/pub/master/cwolfe2/doc/Tom Wolfe Thesis.d… · Web viewThe equation that determines the force acting on given volume of incompressible

15

In the above equation, is the coefficient of stiffness and is the dampening

coefficient. The use of stiffness and dampening in the force equation allows for

simulation of different boundary materials, such as concrete or foam. The force field

method still suffers from particle deficiency at the boundary, but the ability to

simulate different materials at the boundary is a useful tradeoff.

Monaghan [MON94] suggested a popular solution to this problem. A grid of

“virtual particles” is placed on the boundary. The virtual particles have the same

density as the initial density of the fluid. As a fluid particle nears the boundary, the

virtual particles exert a force on the real particle that resembles the Lennard-Jones

potential. The force equation for this interaction is:

Eq. 22

where and are taken as 12 and 6 respectively. The force is applied along the

centerline of the two particles. The penalty force produces a weak attractive force for

relatively large distances, but for extremely short distances, produces a very strong

repulsive force that is stronger the closer the particles are, mimicking molecular

interactions. This repulsive force prevents the fluid particles from penetrating the

boundary.

Page 25: VIEW COHERENCE IN RAY TRACINGcs.uccs.edu/~gsc/pub/master/cwolfe2/doc/Tom Wolfe Thesis.d… · Web viewThe equation that determines the force acting on given volume of incompressible

CHAPTER III

NEW ALGORITHM DESIGNS

SPH Acoustic Modeling Simulation

Initialization

Initialization of the simulation occurs when an SPH scene file is loaded. This

scene file specifies configuration for the following: global settings, fluid parameters,

boundary conditions, the sound emitter and the sound receiver. The global settings

configuration specifies the simulation time step and any external global forces, such

as gravity. The fluid settings specify a cuboid shaped lattice of SPH particles defined

by a position, width, height and length. The initial density, equation of state stiffness

constant and viscosity constant are also defined here. For each boundary, the

position, orientation, size and energy absorption properties are defined. The

boundary can be one of three different shapes: rectangle, disc and cylindrical surface.

There can be more than one boundary in the scene file and complex structures such as

rooms, halls and cathedrals can be constructed from individual boundary objects. The

sound emitter specifies the input WAV file (the source sound), position and size. The

emitter is based on a disc type boundary. The sound receiver specifies the output

Page 26: VIEW COHERENCE IN RAY TRACINGcs.uccs.edu/~gsc/pub/master/cwolfe2/doc/Tom Wolfe Thesis.d… · Web viewThe equation that determines the force acting on given volume of incompressible

17

WAV file (the source sound with any reverberation from the environment) and a

listening position.

Simulation – Stage 1

Before a source sound can be processed through the simulation, the fluid must

first reach an equilibrium state. The system is said to be in equilibrium when

boundary forces acting on the fluid are equivalent to forces due to the pressure

gradient internal to the fluid itself. To reach this state, the simulation must proceed

from initialization without any sound source inducing energy into the system. The

system runs in this state until a satisfactorily low energy is reached:

Eq. 23

where L is a sufficiently small number (we use 0.00001 J). When equilibrium is

reached, the simulation then proceeds to stage 2, detailed below

Simulation – Stage 2

After equilibrium is reached, the emitter is engaged, which propagates the

source sound through the fluid. At the end of each time step, the sound receiver

calculates the density at its location. The density at the receiver is compared with the

reference density of the fluid. Any excess density will be recorded as a positive

deflection in the output sound file, whereas low density will be recorded as a negative

deflection.

Page 27: VIEW COHERENCE IN RAY TRACINGcs.uccs.edu/~gsc/pub/master/cwolfe2/doc/Tom Wolfe Thesis.d… · Web viewThe equation that determines the force acting on given volume of incompressible

18

New Sound Emitter Algorithm

The sound emitter is an object that acts as a boundary in the simulation, but is

allowed to move according to a positive or negative deflection from the DC value in

the input sound file. A positive deflection will result in a positive movement in the

emitter along the x-axis. A negative deflection in the input sound file will result in a

negative movement of the emitter along the x-axis. The magnitude of the movement

along the x-axis is dependent upon a user-definable deflection factor that is set in the

scene file. The magnitude of the x-axis movement is determined by the following

equation:

Eq. 24

where s is the input sample (a 16-bit signed integer), t is the current sample and k is

the deflection factor. In effect, this states that the emitter cannot be deflected more

than k units on either the positive or negative x-axis. The emitter propagates the

sound wave through the fluid by interacting with the fluid particles that are its

neighbors. As the emitter moves, the Lennard-Jones potential induces a force on the

fluid particles, causing the fluid to move in sync with the emitter, and thus the source

sound itself.

Page 28: VIEW COHERENCE IN RAY TRACINGcs.uccs.edu/~gsc/pub/master/cwolfe2/doc/Tom Wolfe Thesis.d… · Web viewThe equation that determines the force acting on given volume of incompressible

19

New Sound Receiver Algorithm

The purpose of the sound receiver is to capture the vibrations in the fluid as an

acoustic wave. When the simulation first enters stage 2, before the sound emitter

starts to move, the fluid density is calculated at the receiver location. This density is

stored as the receiver’s reference density and is used in subsequent time steps to

determine the positive or negative deflection from the reference. This deflection is

then stored as a sample in the output sound file according to the following equation:

Eq. 25

where is the tth sample, is the receiver’s reference density and is the density

of the fluid at the receiver’s location. As in the input sound file, the sample is stored

as a 16-bit signed integer. To ensure that background noise is filtered out, the output

sound file’s DC component is determined, the entire sound file is adjusted to make

the DC component zero, and then the sound file is normalized.

Page 29: VIEW COHERENCE IN RAY TRACINGcs.uccs.edu/~gsc/pub/master/cwolfe2/doc/Tom Wolfe Thesis.d… · Web viewThe equation that determines the force acting on given volume of incompressible

CHAPTER IV

IMPLEMENTATION

One of the goals of this project was to make the system usable for near-

realtime processing of reverberation. Thus, it was decided that the system would be

developed in C++ with performance in mind. To visualize the particle system in 3D,

OpenGL was employed as the graphics engine. The SPH acoustic simulation

developed for this thesis is based on the core of a water splash simulation that I wrote

for the Computer Animation and Scientific Visualization course in the Spring of

2005. For the water splash animation, I implemented an SPH solver that simulated

water as a compressible fluid that used an artificial equation of state to keep the fluid

particles at a somewhat constant density. For the acoustic simulation, the bulk of the

SPH calculations remained the same, with the equation of state for an ideal gas being

substituted in place of the artificial equation of state for water.

Overview of Class Hierarchy

Modularization was a primary goal with the SPH system. The ability to

rapidly substitute different kernel types, boundary conditions and boundary shapes

was greatly desired for trying many different environments and conditions. To this

end, the simulation employs an inheritance model that supports the above

Page 30: VIEW COHERENCE IN RAY TRACINGcs.uccs.edu/~gsc/pub/master/cwolfe2/doc/Tom Wolfe Thesis.d… · Web viewThe equation that determines the force acting on given volume of incompressible

requirements. The class hierarchy is shown below along with descriptions of each

class.

cd Class Model

SPHSimulator

SPHKernel

SPHKernelPoly6 SPHKernelSpikySPHKernelViscosity

SPHParticle

SPHBoundary

SPHCylinderBoundary SPHDiscBoundarySPHRectangleBoundary

SPHGrid SPHGridCell

SPHSoundReceiv er

SPHSoundEmitter

Camera

WAVFile

Figure 4: SPH Acoustic Simulation Class Hierarchy.

Class SPHSimulator

The SPHSimulator class is the primary processing center for the SPH

simulation. It is responsible for creating, managing and destroying every other SPH

related object in the system. The following processing methods are provided by

SPHSimulator:

Page 31: VIEW COHERENCE IN RAY TRACINGcs.uccs.edu/~gsc/pub/master/cwolfe2/doc/Tom Wolfe Thesis.d… · Web viewThe equation that determines the force acting on given volume of incompressible

Load() – Reads in a scene file and sets up the system to simulate the

environment specified in the file. Particle creation and initialization is

done during this step.

StepSimulation – Steps the simulation forward one time step (the duration

of the time step is defined in the scene file). The following pseudocode

outlines this process:

1. For each particle, assign neighboring particles to neighbor list (see

SPHGrid section below).

2. For each particle, compute its density according to Eq. 11:

3. For each particle, compute its pressure according to the following

equation of state for ideal gases:

Eq. 27

where is the gas stiffness constant (78120.9 J/kg at 273.15 K for

air).

4. For each particle, compute the force acting on the particle due to

the pressure according to the Eq. 8 and the viscosity according to:

Eq. 28

where k is the viscosity coefficient of the fluid and j is not a

boundary particle, otherwise if j is a boundary particle, use Eq. 22

for the Lennard-Jones force.

5. Integrate the equations of motion to find the new velocity and

position according to the Leap-Frog method.

Page 32: VIEW COHERENCE IN RAY TRACINGcs.uccs.edu/~gsc/pub/master/cwolfe2/doc/Tom Wolfe Thesis.d… · Web viewThe equation that determines the force acting on given volume of incompressible

6. For each sound emitter, read the next sample in the WAV file and

move the emitter accordingly (see SPHEmitter section below).

Class SPHParticle

This class is used for storage of an individual particle’s state. The variables

(and their units) that make up the particle’s state are: rest density (kg/m3), density

(kg/m3), mass , pressure (Pa), fluid viscosity constant, position vector (m),

velocity vector(m/s), acceleration vector (m/s2) and a list of neighboring particles.

Class SPHKernel and Derivatives

The SPHKernel class is an abstract class the enables the simulation to use

drop-in kernel equations. Three different kernel types are supported: Monaghan’s B-

spline kernel, Desbrun’s spiky kernel and Müller’s viscosity kernel. The SPHKernel

base class exposes three pure virtual methods that each subclassed kernel must

implement: W() for the kernel itself, dW() for the kernel gradient and lap() for the

Laplacian of the kernel.

Classes SPHGrid and SPHGridCell

Page 33: VIEW COHERENCE IN RAY TRACINGcs.uccs.edu/~gsc/pub/master/cwolfe2/doc/Tom Wolfe Thesis.d… · Web viewThe equation that determines the force acting on given volume of incompressible

When the SPHSimulator class performs an AssignNeighbors() action, a grid

(represented by the SPHGrid class) is superimposed on the particle collection. This

grid is used as a spatial data structure, with cubic buckets having length h. The

buckets store references to SPHParticle objects, which are used to perform a nearest-

neighbor search algorithm. After the AssignNeighbors() action is performed, each

particle will have a list of its neighbors that it uses for the rest of the SPH

computations for the current time step. The neighbor search algorithm proceeds as

follows:

1. For each SPHGridCell in SPHGrid, clear the particle list.

2. For each particle i,

a. Clear the neighbor list.

b. Add i to the neighbor list (i is its own neighbor).

c. Search the cells adjacent to the cell containing i for neighbors.

d. A particle j in an adjacent cell is considered a neighbor of i only if

the distance from i to j < h. If j is a neighbor of i, add a reference

to j to i’s neighbor list.

e. Add a reference to i to the current cell’s contents.

Class SPHBoundary and Derivatives

The SPHBoundary class is an abstract class that encapsulates a boundary wall

in the simulation. The base class has a position and orientation and subclassing

Page 34: VIEW COHERENCE IN RAY TRACINGcs.uccs.edu/~gsc/pub/master/cwolfe2/doc/Tom Wolfe Thesis.d… · Web viewThe equation that determines the force acting on given volume of incompressible

SPHBoundary allows for the creation of boundaries that have different shapes and

collision detection/response algorithms. The shapes currently supported in this

implementation are: cylindrical (3D volume), disc-shaped (2D area) and rectangular

(2D area). In addition, two different methods for collision detection/response are

supported: boundary-force and virtual particles. If using the boundary-force method,

no virtual particles are created. The force equation used for the boundary-force

method is Eq. 21. If virtual particles are desired, the CreateParticles() method can be

implemented to create a lattice of virtual particles based upon the shape of the

boundary. The collision response equation used for the virtual particles is the

Lennard-Jones potential found in Eq. 22.

Class SPHSoundEmitter

The sound emitter class is derived from one of the concrete classes based on

SPHBoundary. In effect, it is a boundary that moves according to input samples from

a WAV sound file. The emitter is centered on a rest position, and then vibrates

according to the sound file defined for the emitter. A configurable maximum

deflection is used to provide amplitude control for the produced sound wave. For

each time step that is processed in SPHSimulator::StepSimulation(), the emitter reads

the sample corresponding to the time step, and moves itself along its local x-axis by

an amount defined by:

Eq. 29

Page 35: VIEW COHERENCE IN RAY TRACINGcs.uccs.edu/~gsc/pub/master/cwolfe2/doc/Tom Wolfe Thesis.d… · Web viewThe equation that determines the force acting on given volume of incompressible

where is the rest position, k is the maximum deflection and is the sample at

time t (and ).

Class SPHSoundReceiver

The SPHSoundReceiver class simulates a sound receiver, such as a

microphone. When stage 1 of the SPH simulation starts, the receiver calculates the

density of the fluid at its location based upon the weighted sum of the particle masses

surrounding it (Eq. 11). It stores this initial value as a reference density. For each

time step afterwards, the density is again measured by the same method and

compared against the reference density. This deflection (negative or positive) is

stored as a double-precision floating point value between -1 and 1. In addition, an

output WAV file is created at the end of each time step that represents the sound

wave the receiver detected up to and including that time step. The deflections are

converted to 16-bit signed integer WAV samples by multiplying them by 32768.

Class WAVFile

This class is used to store WAV format sound files in memory and allows

access to the individual samples. This class is used in the SPHSoundEmitter class as

an input sound, and in the SPHSoundReceiver class as an output sound.

Page 36: VIEW COHERENCE IN RAY TRACINGcs.uccs.edu/~gsc/pub/master/cwolfe2/doc/Tom Wolfe Thesis.d… · Web viewThe equation that determines the force acting on given volume of incompressible

Class Camera

To visualize the particle system, a camera with the ability to move in all three

dimensions as well as rotate around all three axes was created. A Camera object is

created for each OpenGL window used in the simulation (currently only one view is

used). A reference to this camera is then passed into the SPHSimulator, and is then

passed again to the SPHParticle and SPHBoundary classes during the rendering

phase.

Page 37: VIEW COHERENCE IN RAY TRACINGcs.uccs.edu/~gsc/pub/master/cwolfe2/doc/Tom Wolfe Thesis.d… · Web viewThe equation that determines the force acting on given volume of incompressible

CHAPTER V

RESULTS

Simulation Setup

Since the SPH approach to acoustic modeling has not been attempted before, a

test plan was created to find the variable settings that produced the most desirable

results. The simulation has the ability to load individual scene files, which are

comprised of the simulation variables and an enclosed space generated by SPH fluid

boundaries. The simulation variables that are exposed via the scene file are: timestep

and fluid parameters (# of particles, initial volume, mass, viscosity and stiffness

constants). In all simulation runs, we ignore temperature changes in the fluid.

Acoustic energy is converted to heat by specifying different values for the boundary

dampening constant.

In addition to the simulation variables, complex environments can be created

by assembling individual boundaries (walls) into rooms or halls. For this thesis, three

different types of boundaries were created: rectangular, cylindrical and disc-shaped.

In all test environments generated, a rectangular or box-shaped room was assembled

from six rectangular boundaries. For a boundary, the size, orientation, stiffness and

dampening can be adjusted to simulate materials with different acoustic properties,

Page 38: VIEW COHERENCE IN RAY TRACINGcs.uccs.edu/~gsc/pub/master/cwolfe2/doc/Tom Wolfe Thesis.d… · Web viewThe equation that determines the force acting on given volume of incompressible

such as sound absorption (low stiffness, high dampening) or sound reflection (high

stiffness, low dampening).

The sound emitter can be of any size, but is restricted to a disc-shaped object.

Since the emitter is also a boundary, stiffness and dampening can also be specified,

but is usually set to high stiffness and low dampening so the sound can be propagated

through the system efficiently. A deflection constant can also be specified for the

emitter, guaranteeing that the emitter will never move beyond a certain distance from

its rest position. The deflection constant is analogous to the Maximum Linear

Excursion (XMax/XLin) parameter for a loudspeaker cone. A single input WAV file

is specified for the emitter. The sound receiver specifies a single output WAV file

and a world position vector.

Simulation Results

For the simulation runs, two different WAV files were created. The first was

designed to produce a very short impulse and very quickly decay to zero after the

burst. The impulse is an attempt to recreate the traditional method of determining an

environment’s reverberation properties, such as firing a pistol filled with blanks. The

second WAV file is a music application of the simulation and consists of a brief Latin

piano melody with a shaker accompaniment. To compare the output from the

simulator to a professional reverberation effect, an additional WAV file was created

by processing the piano sample with the “Hall 1” reverberation effect from a Yamaha

S90 ES synthesizer and recording the result. In Figures 5 through 8, the time domain

Page 39: VIEW COHERENCE IN RAY TRACINGcs.uccs.edu/~gsc/pub/master/cwolfe2/doc/Tom Wolfe Thesis.d… · Web viewThe equation that determines the force acting on given volume of incompressible

and frequency domain graphs for both the impulse and piano melody are displayed.

These figures will be compared with the simulation output.

Figure 5: Time and domain graph of “dry” impulse WAV.

Figure 6: Frequency domain graph of “dry” impulse WAV.

Page 40: VIEW COHERENCE IN RAY TRACINGcs.uccs.edu/~gsc/pub/master/cwolfe2/doc/Tom Wolfe Thesis.d… · Web viewThe equation that determines the force acting on given volume of incompressible

Figure 7: Time domain graph of “dry” piano melody WAV.

Figure 8: Frequency domain graph of “dry” piano melody WAV.

Page 41: VIEW COHERENCE IN RAY TRACINGcs.uccs.edu/~gsc/pub/master/cwolfe2/doc/Tom Wolfe Thesis.d… · Web viewThe equation that determines the force acting on given volume of incompressible

In the sections that follow, the simulation parameters for each scene tested

will be displayed, as well as time-domain and frequency-domain graphs of the input

and output. A brief analysis of the scene file and the simulation will also be

presented.

Scene File 1

Simulation time step 0.0000226757 sFluid stiffness constant 78120.9 J/kg at 273.15 KFluid viscosity constant 0.1Smoothing length 0.40 mMass per particle 5.16 kgParticle rest density 1.29 kg/m3

Environment volume 8000.0 m3

Boundary stiffness constant 1000000000Boundary dampening constant 0.1Sound emitter radius 0.5 mSound emitter stiffness constant 300000000.0Sound emitter dampening constant 0.1Sound emitter deflection factor 0.02 m

Table 1: Scene file variable settings for scene file #1

The first simulation scene was created by inputting a “best guess” value for

each parameter in the simulation. The time step is set at 1/44100, or the sampling

frequency of the input WAV file. The fluid stiffness constant was generated by

taking the Ideal Gas Equation ( ) and solving it for the appropriate constant k for

air for a known pressure and density. The viscosity constant was set as low as

possible without sacrificing stability in the SPH equations for the specified time step

duration. The boundary stiffness and dampening were set so as to generate a high

reflection factor with minimal acoustic energy loss. The emitter size and deflection

Page 42: VIEW COHERENCE IN RAY TRACINGcs.uccs.edu/~gsc/pub/master/cwolfe2/doc/Tom Wolfe Thesis.d… · Web viewThe equation that determines the force acting on given volume of incompressible

factor were set to appropriate values to simulate a common loudspeaker in the

environment.

The results from the simulation of scene file #1 show promise. Using the

impulse WAV as input to the simulation, the resulting output is similar in sound.

Reverberation can be heard as the impulse decays, and has a hollow, metallic quality.

In the time domain graph shown in Figure 9, the sound receiver’s initial density is

incorrectly high, most likely because of minor fluctuations in density at the receiver

position due to the chaotic movement of the fluid particles.

Figure 9: Time domain graph of impulse WAV from scene file #1.

Although the simulation did produce reverberation, the frequency spectrum in

Figure 10 shows that the output impulse had a power gain around 4000 Hz. This data

agrees with the author’s observation of hearing the reverberation as a hollow, metallic

Page 43: VIEW COHERENCE IN RAY TRACINGcs.uccs.edu/~gsc/pub/master/cwolfe2/doc/Tom Wolfe Thesis.d… · Web viewThe equation that determines the force acting on given volume of incompressible

sound. The second simulation run using scene file #1 used the piano melody as the

input WAV file. As with the impulse WAV, a hollow, metallic reverberation was

observed.

Figure 10: Frequency domain graph of impulse WAV from scene file #1.

The time domain graph in Figure 11 shows the sound reverberating between

the individual notes in the melody when compared with the “dry” input. One

interesting artifact with this simulation can be observed in Figure 12 around 5500 Hz:

due to the smoothing effect of the SPH interpolation, the sound was effectively low-

pass filtered starting around 5500 Hz. This produced an undesirable muddy sound

quality in the output WAV. Using more fluid particles may produce better results,

but the resulting computation time would be too great to be of any great value.

Page 44: VIEW COHERENCE IN RAY TRACINGcs.uccs.edu/~gsc/pub/master/cwolfe2/doc/Tom Wolfe Thesis.d… · Web viewThe equation that determines the force acting on given volume of incompressible

Figure 11: Time domain graph of piano melody WAV from scene file #1.

Figure 12: Frequency domain graph of piano melody WAV from scene file #1.

Page 45: VIEW COHERENCE IN RAY TRACINGcs.uccs.edu/~gsc/pub/master/cwolfe2/doc/Tom Wolfe Thesis.d… · Web viewThe equation that determines the force acting on given volume of incompressible

Scene File 2

For scene file #2, only the sound emitter orientation was modified. In scene

file #1, the emitter surface normal (the axis of sound propagation) was parallel with

the long axis of the room. In scene file #2, the emitter was rotated 45 degrees around

the z-axis. The sound produced is almost identical to scene file #1, as was expected.

The time and frequency domain graphs for both the impulse and piano melody WAVs

are almost identical to scene file #1, as is shown in Figures 13 through 16.

Figure 13: Time domain graph of impulse WAV from scene file #2.

Page 46: VIEW COHERENCE IN RAY TRACINGcs.uccs.edu/~gsc/pub/master/cwolfe2/doc/Tom Wolfe Thesis.d… · Web viewThe equation that determines the force acting on given volume of incompressible

Figure 14: Frequency domain graph of impulse WAV from scene file #2.

Figure 15: Time domain graph of piano melody WAV from scene file #2.

Page 47: VIEW COHERENCE IN RAY TRACINGcs.uccs.edu/~gsc/pub/master/cwolfe2/doc/Tom Wolfe Thesis.d… · Web viewThe equation that determines the force acting on given volume of incompressible

Figure 16: Frequency domain graph of piano melody WAV from scene file #2.

Scene File 3

For scene file #3, the distance at which the particles interact with the

boundaries was changed from 0.004 m to 0.008 m. This slight change made the

system unstable and produced white noise for the duration of the input sound for both

the impulse and piano melody. As in both scene files #1 and #2, the sound was

effectively low-pass filtered due to the SPH smoothing effect. Figures 17 through 20

show the time and frequency domain graphs for both the impulse and piano melody

WAV as processed with scene file #3.

Page 48: VIEW COHERENCE IN RAY TRACINGcs.uccs.edu/~gsc/pub/master/cwolfe2/doc/Tom Wolfe Thesis.d… · Web viewThe equation that determines the force acting on given volume of incompressible

Figure 17: Time domain graph of impulse WAV from scene file #3.

Figure 18: Frequency domain graph of impulse WAV from scene file #3.

Page 49: VIEW COHERENCE IN RAY TRACINGcs.uccs.edu/~gsc/pub/master/cwolfe2/doc/Tom Wolfe Thesis.d… · Web viewThe equation that determines the force acting on given volume of incompressible

Figure 19: Time domain graph of piano melody WAV from scene file #3.

Figure 20: Frequency domain graph of piano melody WAV from scene file #3.

Page 50: VIEW COHERENCE IN RAY TRACINGcs.uccs.edu/~gsc/pub/master/cwolfe2/doc/Tom Wolfe Thesis.d… · Web viewThe equation that determines the force acting on given volume of incompressible

Scene File 4

For scene file #4, the sound emitter deflection factor was scaled by a factor of

two. The sound produced is almost identical to scene file #2, but the impulse WAV

had a sharper attack, benefiting from the larger deflection factor for the emitter. The

piano melody, however, seemed to sound quite a bit more hollow and distant than the

original. The time and frequency domain graphs for both the impulse and piano

melody WAVs seem to suggest that more high frequency components of the original

sound are preserved, as is shown in Figures 21 through 24.

Figure 21: Time domain graph of impulse WAV from scene file #4.

Page 51: VIEW COHERENCE IN RAY TRACINGcs.uccs.edu/~gsc/pub/master/cwolfe2/doc/Tom Wolfe Thesis.d… · Web viewThe equation that determines the force acting on given volume of incompressible

Figure 22: Frequency domain graph of impulse WAV from scene file #4.

Figure 23: Time domain graph of piano melody WAV from scene file #4.

Page 52: VIEW COHERENCE IN RAY TRACINGcs.uccs.edu/~gsc/pub/master/cwolfe2/doc/Tom Wolfe Thesis.d… · Web viewThe equation that determines the force acting on given volume of incompressible

Figure 24: Frequency domain graph of piano melody WAV from scene file #4.

Scene File #5

For scene file #5, the EOS stiffness was decreased by a factor of ten. This

should allow the fluid to compress more when a sound wave is propagated through it.

However, this change made the impulse WAV unrecognizable (Figures 23 and 24),

and the high frequency components of the piano melody WAV disappeared (Figures

25 and 26).

Page 53: VIEW COHERENCE IN RAY TRACINGcs.uccs.edu/~gsc/pub/master/cwolfe2/doc/Tom Wolfe Thesis.d… · Web viewThe equation that determines the force acting on given volume of incompressible

Figure 25: Time domain graph of impulse WAV from scene file #5.

Figure 26: Frequency domain graph of impulse WAV from scene file #5.

Page 54: VIEW COHERENCE IN RAY TRACINGcs.uccs.edu/~gsc/pub/master/cwolfe2/doc/Tom Wolfe Thesis.d… · Web viewThe equation that determines the force acting on given volume of incompressible

Figure 27: Time domain graph of piano melody WAV from scene file #5.

Figure 28: Frequency domain graph of piano melody WAV from scene file #5.

Page 55: VIEW COHERENCE IN RAY TRACINGcs.uccs.edu/~gsc/pub/master/cwolfe2/doc/Tom Wolfe Thesis.d… · Web viewThe equation that determines the force acting on given volume of incompressible

Scene File #6

For scene file #6, the EOS stiffness was increased by a factor of ten from

scene file #4. This should allow the fluid to react more quickly when a sound wave is

propagated through it. However, the increased EOS stiffness constant caused the

simulation to be unstable at the specified time step. Thus, the time step was

decreased, requiring significantly more computation time (2 ½ days to complete on an

AMD Athlon 2000+). The sound had significantly increased high frequency

components as is visible in Figures 28 and 30. However, the reverberation properties

that existed in previous simulation were missing. In addition, the extremely long

computation time makes the increase of the stiffness constant impractical.

Figure 29: Time domain graph of impulse WAV from scene file #6.

Page 56: VIEW COHERENCE IN RAY TRACINGcs.uccs.edu/~gsc/pub/master/cwolfe2/doc/Tom Wolfe Thesis.d… · Web viewThe equation that determines the force acting on given volume of incompressible

Figure 30: Frequency domain graph of impulse WAV from scene file #6.

Figure 31: Time domain graph of piano melody WAV from scene file #6.

Page 57: VIEW COHERENCE IN RAY TRACINGcs.uccs.edu/~gsc/pub/master/cwolfe2/doc/Tom Wolfe Thesis.d… · Web viewThe equation that determines the force acting on given volume of incompressible

Figure 32: Frequency domain graph of piano melody WAV from scene file #6.

Scene File #7

For scene file #7, the simulation boundary condition was changed from using

Equation 21 to using virtual particles that exert a Lennard-Jones potential on the fluid.

It was assumed that using the Lennard-Jones force would allow for a simulation that

produced more stable reflections of the sound wave than using the force field from

Equation 21. This proved not to be the case, however, as the purely repulsive

equation of state coupled with the highly compressible fluid tended to produce high

amplitude oscillations in the fluid particles near the boundary. These oscillations

created undesired results in the output sound.

Page 58: VIEW COHERENCE IN RAY TRACINGcs.uccs.edu/~gsc/pub/master/cwolfe2/doc/Tom Wolfe Thesis.d… · Web viewThe equation that determines the force acting on given volume of incompressible

Figure 33: Time domain graph of impulse WAV from scene file #7.

Figure 34: Frequency domain graph of impulse WAV from scene file #7.

Page 59: VIEW COHERENCE IN RAY TRACINGcs.uccs.edu/~gsc/pub/master/cwolfe2/doc/Tom Wolfe Thesis.d… · Web viewThe equation that determines the force acting on given volume of incompressible

Figure 35: Time domain graph of piano melody WAV from scene file #7.

Figure 36: Frequency domain graph of piano melody WAV from scene file #7.

Page 60: VIEW COHERENCE IN RAY TRACINGcs.uccs.edu/~gsc/pub/master/cwolfe2/doc/Tom Wolfe Thesis.d… · Web viewThe equation that determines the force acting on given volume of incompressible

Scene Files #8 through #20

For the rest of the scene file simulations, an attempt was made to improve the

reverberation response of the SPH algorithm using virtual particles and the Lennard-

Jones force. The viscosity coefficient was increased and decreased as well as the

fluid’s equation of state stiffness constant. The room size and shape was altered by

creating small square rooms, large square rooms, large rectangular rooms and small

rectangular rooms. A dampening constant was also added to the Lennard-Jones

potential. None of these modifications eliminated the oscillations that were created

by the virtual particles, nor did any of these runs produce results that were better than

scene file #4.

Results Conclusion

Although a lot of variables were tested for the most desirable reverberation

output throughout the simulation runs, this thesis has by no means been an exhaustive

trial. Almost all aspects of the simulation can be tweaked or modified in some way to

produce drastically different results. Examples of parts of the system which can be

modified or replaced outright with new formulae are: smoothing kernels, smoothing

length, equations of state, boundary conditions, viscosity and energy. At the very

least, we have proved that in theory and limited application that the SPH algorithm

can be a viable simulation tool for acoustic modeling.

Page 61: VIEW COHERENCE IN RAY TRACINGcs.uccs.edu/~gsc/pub/master/cwolfe2/doc/Tom Wolfe Thesis.d… · Web viewThe equation that determines the force acting on given volume of incompressible

CHAPTER VI

FUTURE WORK

Accuracy of Reverberation

Before this simulation can be considered a replacement for DSP methods, the

accuracy of the reverberation results must be improved. The methods that are used in

the simulation to handle boundary conditions represent the most obvious starting

place to improve the simulation. The simple “force field” and Lennard-Jones

equations are not sufficient methods to simulate a complex acoustic material.

Another method must be developed that models frequency response to the material in

addition to refraction and diffusion of sound waves. Next, the equation of state could

be replaced with a more robust model. This thesis used only the Ideal Gas Law as the

equation of state and ignored the thermal component. The stiffness constant that was

required bordered on being too high for the simulation to remain stable at reasonable

timesteps. In addition, we did not simulate the thermal properties of the fluid, as we

assumed the temperature would be more or less constant and any thermal conversion

of the acoustic energy would be simulated in the boundary dampening factor.

Another possibility for improvement is using different smoothing kernels for

the density, pressure gradient and viscosity equations. Smoothing kernels have been

known to produce odd behavior if not properly adapted to the application [MÜLL03].

Page 62: VIEW COHERENCE IN RAY TRACINGcs.uccs.edu/~gsc/pub/master/cwolfe2/doc/Tom Wolfe Thesis.d… · Web viewThe equation that determines the force acting on given volume of incompressible

53

Liu and Liu have devoted an entire chapter of their SPH book to constructing custom

smoothing kernels [LIU03]. For the pressure gradient and viscosity equations, care

must be taken to ensure that the kernel derivative and Laplacian exist.

Acoustic Modeling

Although this thesis focused solely on simulation of reverberation, another

possible application of the simulation, once properly adapted, is to perform general

acoustic modeling. This type of simulation is useful in many industries, including

building design, automobile, aircraft and marine design and music production. To

this end, an equation of state that includes thermal energy must be used, as well as the

simulation of the acoustic absorption and refraction effects of different materials. For

the equation of state, the standard Ideal Gas Law would still apply for simulation of

air, if simulated in the well known form. However, a new boundary

design would have to be considered that allowed the sound to propagate through the

boundary material. This could be accomplished by treating the walls and other

obstacles not as boundaries, but as solid masses of particles that the fluid interacts

with. The particles could be connected by a damped mass-spring system that would

allow sound wave propagation and thermal energy transfer. With this type of a

system, the simulation could easily handle a very dynamic environment, where the

boundaries and other obstacles are able to move in time.

Page 63: VIEW COHERENCE IN RAY TRACINGcs.uccs.edu/~gsc/pub/master/cwolfe2/doc/Tom Wolfe Thesis.d… · Web viewThe equation that determines the force acting on given volume of incompressible

CHAPTER VI

CONCLUSION

This thesis has presented the history and theory of acoustic modeling of

reverberation, as well as the history of the Smoothed Particle Hydrodynamics method

of fluid mechanics simulation. The lack of a general solution to the acoustic

modeling problem when dealing with complex environments was noted. Using the

SPH fluid mechanics algorithm as a base, new algorithms were developed for sound

emission and reception. An SPH simulation application utilizing C++ and OpenGL

was developed that allowed the testing of the new algorithms.

Although the results that were generated show promise, the system as

implemented is still far from being a solution to the general acoustic modeling

problem. The fact that reverberation was simulated even to a small degree of

accuracy demonstrates that the SPH algorithm is a tool worth exploring for acoustic

modeling simulation of complex environments. If an optimal solution is discovered,

the use of SPH as a tool in acoustic modeling can be exploited. Possible uses include

music studio design, architecture and acoustic dampening for the automotive, aircraft

and marine industries.

Page 64: VIEW COHERENCE IN RAY TRACINGcs.uccs.edu/~gsc/pub/master/cwolfe2/doc/Tom Wolfe Thesis.d… · Web viewThe equation that determines the force acting on given volume of incompressible

BIBLIOGRAPHY

[CASH02] Cash, J. 2002. Modeling the accretion stream in polars. Ph.D.

Dissertation, Department of Physics and Astronomy, University of

Wyoming.

[DESB96] Desbrun, M. and Gascuel, M. 1996. Xue, L. 2004. A new paradigm for

animating highly deformable bodies. Computer Animation and

Simulation '96. 61-76.

[EVER01] Everest, F., Master handbook of acoustics, Fourth edition, McGraw

Hill, 2001.

[FUNK98] Funkhouser, T., et al. 1998. A beam tracing approach to acoustic

modeling for interactive virtual environments. Computer Graphics

(SIGGRAPH ’98). 21-32.

[LI64] Li, W and Lam S., Principles of fluid mechanics, Addison-Wesley,

1964

[LIU03] Liu, G. and Liu, M., Smoothed particle hydrodynamics: a meshfree

particle method, World Scientific, 2003.

[LUCY77] Lucy, L. 1977. A numerical approach to the testing of the fission

hypothesis. The Astronomical Journal, Volume 82, Number 12.

Page 65: VIEW COHERENCE IN RAY TRACINGcs.uccs.edu/~gsc/pub/master/cwolfe2/doc/Tom Wolfe Thesis.d… · Web viewThe equation that determines the force acting on given volume of incompressible

[MONA77] Monaghan, J., Gingold, R. 1977. Smoothed particle hydrodynamics:

theory and application to non-spherical stars. Monthly Notices of the

Royal Astronomical Society. 181(2):375-389.

[MONA92] Monaghan, J. 1992. Smoothed particle hydrodynamics. Annual Review

of Astronomy and Astrophysics. 543-574.

[MONA94] Monaghan, J., et al. 1994. Simulation of free surface flows with SPH.

ASME Symposium on Computation Methods in Fluid Dynamics.

[MÜLL03] Müller, M. et al. 2003. Particle-based fluid simulation for interactive

applications. Eurographics/SIGGRAPH Symposium on Computer

Animation.

[ROY95] Roy, T. 1995. Physically-based fluid modeling using smoothed particle

hydrodynamics. M.S. Thesis, University of Illinois at Chicago.

[WHIT01] White, P., 2001. Advanced reverberation, Part 1. Sound on Sound,

October, 2001.

[WHIT01] White, P., 2001. Advanced reverberation, Part 2. Sound on Sound,

November, 2001.