0
0

hello,
I get some wierd behavior of geometry occlusions. Here’s code i wrote to illustrate the situation:

[code:jxa8ff9v]
result = FMOD::EventSystem_Create(&event_system); CHK(result);
result = event_system->init(256, FMOD_INIT_NORMAL, 0); CHK(result);
FMOD::EventProject* fmod_project;
result = event_system->load("media/sounds.fev", NULL, &fmod_project); CHK(result);
FMOD::Event* ev1;
FMOD::EventGroup* eg = NULL;
result = event_system->getGroup("sounds/test", true, &eg); CHK(result);
FMOD::System *system;
event_system->getSystemObject(&system);

FMOD::Geometry *geometry;
result = system->setGeometrySettings(100.f); CHK(result);
result = system->createGeometry(4, 16, &geometry); CHK(result);
FMOD_VECTOR poly[4] =
{
{-100, -100, 0.5f},
{100, -100, 0.5f},
{ 100, 100, 0.5f},
{-100, 100, 0.5f}
};
int polyIndex;
result = geometry->addPolygon(1.f, 1.f, true,
4, poly, &polyIndex); CHK(result);
result = geometry->setActive(true); CHK(result);

result = eg->getEvent("test1", FMOD_EVENT_RESOURCE_STREAMS_AND_SAMPLES, &ev1); CHK(result);
result = ev1->start(); CHK(result);

FMOD_VECTOR geomPos = {1, 0, 0};
result = geometry->setPosition(&geomPos); CHK(result);
FMOD_VECTOR geomFwd = {-1, 0, 0};
FMOD_VECTOR geomUp = {0, -1, 0};
result = geometry->setRotation(&geomFwd, &geomUp); CHK(result);

while(1)
{
{ // setting listener
FMOD_VECTOR pos = {1, 0, 0};
FMOD_VECTOR vel = {0, 0, 0};
FMOD_VECTOR fwd = {0, 0, 1};
FMOD_VECTOR up = {0, 1, 0};
result = event_system->set3DListenerAttributes(0, &pos, &vel, &fwd, &up); CHK(result);
}

{ // setting events
  FMOD_VECTOR pos = {0, 0, 0};
  FMOD_VECTOR vel = {0, 0, 0};
  FMOD_VECTOR ori = {0, 0, -1};
  ev1->set3DAttributes(&pos, &vel, &ori); CHK(result);
}

result = event_system->update(); CHK(result);

}
[/code:jxa8ff9v]

In this code i assume that listener stands at the world coordinates (1, 0, 0) and event is placed at (0, 0, 0).
Occlusion quad suppose to be at (0.5, 0, 0) right between listener and event so i must hear nothing.
That works fine when geometry up vector is (0, -1, 0). But when up vector is (0, 1, 0) i get
occlusion being at (1.5, 0, 0) and hear the sound (looks like real forward vector of geometry object points at +x,
not -x as it suppose to be according to the code above).
Obviously, up vector must not have effect on sound in this case but still it does..

Am i plain stupid or is it bug in fmod occlusions matrices calculation…
…and how should i handle that in real game code?

all tested on pc fmodex 4.12.03,
i also tried it with FMOD_INIT_SOFTWARE_OCCLUSION flag but it didnt help…
event is spheric…

  • You must to post comments
Showing 0 results
Your Answer

Please first to submit.