Reputation: 1
I want to create spatial sound in Godot using Wwise. I'm using https://github.com/alessandrofama/wwise-godot-integration
The problem is with using AkGeometry node. Using geometry is important to calculate objects' diffraction and transmission (obstruction and occlusion) automatically and to simulate early reflections. The integrator's documentation doesn't clarify how to use this node. It only says that AkGeometry should be a child of a MeshInstance3D node. I couldn't find any tutorial too. When I add AkGeometry as a child to MeshInstance3D node and run the project, I'm getting errors:
E 0:00:02:0587 create_from_surface: Condition "p_mesh.is_null()" is true. Returning: ERR_INVALID_PARAMETER
scene/resources/mesh_data_tool.cpp:43 @ create_from_surface()
and
E 0:00:02:0588 push_error: [AK_InvalidParameter]: set_geometry in src/wwise_gdextension.cpp:931.
core/variant/variant_utility.cpp:1091 @ push_error()
I tried, just for test, assign AkGeometry as a child to 3D Node that is not a MeshInstance3D. Then, unexpectedly, there was no error. (However there was no effect too.)
I tried to assign AkGeometry to a MeshInstance3D using script (of the MeshInstance3D node):
var akGeometry = AkGeometry.new()
add_child(akGeometry)
Then I got the same error as above (it happens in line add_child(akGeometry)
.
In the same script I tried also this:
var akGeometry = AkGeometry.new()
akGeometry.set_geometry(self)
But then, program can't start running (it's loading and loading) and then crashes.
I also tried not using this integrator and use Wwise.set_geometry()
instead. However arguments for this function require getting some data from mesh instance (like array of vertices and array of triangles) and that seems to be quite complicated.
I'm new to Godot and Wwise and I'll appreciate any help!
Upvotes: 0
Views: 71
Reputation: 11
I'm having the same thoughts right now, trying to implement occlusion and obstruction.
About your error, I think if found a bug in the plugin's code. Here, it tries to call the create_from_surface()
method but if the parent's mesh is an ArrayMesh, the array_mesh
variable is not initialised.
I think that's why you get this error:
E 0:00:02:0587 create_from_surface: Condition "p_mesh.is_null()" is true. Returning: ERR_INVALID_PARAMETER scene/resources/mesh_data_tool.cpp:43 @ create_from_surface()
I tried with a BoxMesh and it works fine. I guess the array_mesh
variable should be initialised with the mesh if it is an ArrayMesh.
However, are you sure AkGeometry can be used to automatically calculate obstruction and occlusion? Reading the Audiokinetic documentation, it says:
Game designers must calculate the obstruction and occlusion for each game object that affects each listener and pass the values to the sound engine with the AK::SoundEngine::SetObjectObstructionAndOcclusion() call.
I'm gonna do some testing during the week, first to see if we can automate obstruction and occlusion calculation and if it works, I'll try fixing the plugin. If the fix works, I'll probably create an issue on the plugin's github.
Let me know if you find anything else, I'll tell you what I find ^^
Upvotes: 1
Reputation: 382
What you're doing seems to be right: Attach an AkGeometry node as a child to a MeshInstance3D.
While not directly answering your question, here are a few things that tripped me up at first:
Try generating soundbanks and re-generating Wwise IDs
You might also have to tell Godot to automatically load the Init.bnk. Go to Project Settings, toggle "Advanced Settings", scroll down to the bottom and under the Wwise settings, see "Common User Settings" and check "Load Init Bank at Startup"
Upvotes: 0