Sound in a 3D space

Started by
3 comments, last by Metus 23 years, 7 months ago
I''ve just got my first 3D environment to work using Direct3D IM mode and I''m so happy....next step for me is to integrate my SoundEngine into my "3D Engine" =) But I have a problem! When moving the camera, then the formula i used looks like this; CameraMatrix = MultiplyMatrix)TranslateMatrix(X, Y, Z) * CameraMatrix) and that works perfectly, but when I want to use a sound...i guess i have to multiply the CameraMatrix with the D3DVECTOR coords of the sound..but how? is there anyone out there who can help me? sincerely Patrik Wixner
Ethereal
Advertisement
Why do you even have to use matrices? You camera has a xyz position
and your sound has a xyz position. Can''t you just calculate the distance
between these two 3D points and play the volume accordingly?


Wayfarer
Well..no...I''m using DirectSound3D and that are supposed to do that by itself (Volume).

The reason why I''m using Matrices are that I''m learning D3D in the same stage..so I''m moving around a white box (Supposed to play a sound) and then the DirectSound3D should take care of the rest

Ethereal
You shouldn''t rely on direct 3D to do everything for you. Sure, it''s nice to use it for hardware acceleration and things like that, but if you don''t understand what''s happening behind the scenes you''ll get lost in the long run. That''s why I recommend you should first make a pure software engine and once you understand everything you can start using direct3D.

Just some advice
You know, this is kind of off the subject, but I''ve been thinking about how to do a 3d-sound engine. Sorry, but DS3D won''t cut it I think. If anybody could just use DS3D and be perfect, why would it ever be a problem?

I figure, if I have a sound, it will be an object. Now, I could do it like in Thief, where there is a separate database to tell how the sound reflects and stuff for each level, but I''m thinking of a much more direct approach. I''m thinking about having a sound represented by a point in 3d space. Each frame, I would actually move the point in the direction it''s going, and if it passes within a certain distance of the player (or a bad guy), then you can hear the sound depending on the distance. Over time, of course, the intensity of the sound would gradually reduce to zero. This would allow for echoes and soundproofed areas and a really impressive-looking enemy AI.

Obviously, there are a few problems with this approach:

1. Sound moves really fast. I would have to do many movement/sound calculations in each frame, but if I had my solid BSP tree set up right, it wouldn''t be that big of a problem.

2. Sound doesn''t just travel in one direction. This is the biggie. Perhaps I could just send out 50 objects per sound, and as they spread out it would simulate a spherical sound, but perhaps there is a better idea out there somewhere?

Maybe I''m just rambling. It''s lunch break.



~BenDilts( void );

This topic is closed to new replies.

Advertisement