wave-harmonic / crest

A class-leading water system implemented in Unity
MIT License
3.41k stars 475 forks source link

Procedural Ocean Audio #309

Open ncthbrt opened 4 years ago

ncthbrt commented 4 years ago

The sound of the ocean is a big part of crafting a believable, consistent environment. This may be out of scope for this asset, but having the ability to procedurally generate audio that is aware of the wind, or settings applied to gerstner waves would be an interesting premium feature.

huwb commented 4 years ago

Agreed!

dmonmad commented 4 years ago

That's the best option I've found right now to achieve that... Didn't try it yet, but will do tomorrow. http://answers.unity.com/answers/1152011/view.html

huwb commented 4 years ago

Thanks for the note! I'm very interested to hear how it goes?

andrew-sidereal commented 3 years ago

Any update on this? I'm working on adding audio to Crest in my game and looking for some guidance.

andrew-sidereal commented 3 years ago

This looks very promising. It allows creating an audio region rather than a point, so the entire shoreline could be a region. https://assetstore.unity.com/packages/tools/audio/volumetric-audio-17125#reviews

Is it possible to programmatically create a mesh around the shoreline, e.g. surrounding each island?

andrew-sidereal commented 3 years ago

This seems to do it: http://www.heparo.com/img/portfolio/shoregen/documentation/shoregenerator_manual.html

huwb commented 3 years ago

Thank you for recording your notes. We haven't made progress on our side but it's on our radar. Please keep sharing notes if you have them.

huwb commented 3 years ago

This is still on the list, it seems to always be one or two items further down than what we have bandwidth to look at, but it is slowly bubbling up..

We're hoping to increase our bandwidth through sponsorship and i wanted to mention that once here in case there is interest in supporting us: https://github.com/sponsors/wave-harmonic

Chris1234567899 commented 2 years ago

Not beeing involved in the development here, but since I recently bought the hdrp version (awesome package guys!!) and focusing the same problem now, I thought about a couple of options here:

The first idea would be placing or (auto)spawning several audio sources around the shoreline. Probably a bad idea, performance wise and sound blending wise. And also extremely time-consuming if done manually...

So what we would actually need, is a single audio source that follows the camera. The primary source of sound are the waves from the shoreline, right? So we would need to check the distance from the camera to the shoreline. Luckily we already have data (somewhere?) on where the shorelines are, right? Could be from the depth cache, or maybe the foam layer, I don't know, but it must be somewhere. There is for example the GUI that shows different maps generated for waves, foam, clipping etc, so theoretically we could just run some image analysis to find the nearest shoreline and based on the distance, camera angle etc adjust the volume of the audio source.

Alternatively, we could place the audio source directly to the closest beach instead of making it follow the camera. This is similar to the one mentioned before, also here we would have to detect the closest shoreline point, transform it into world space and position the audio source there. This would have the advantage of not playing around with the volume... maybe it would be more realistic.

What do you think about that approach?

Now another question is - do we need different sound tracks, for shoreline, open ocean, different wave sizes or wind strengths and if so (I guess we do), we would have to blend somehow between the tracks.

dmonmad commented 2 years ago

In my opinion, the best way I could thought about doing this is creating an Audio Source with the level you want to be heard when literally in front of the shore. Now this Audio Source will follow the player being its position the nearest position possible where the water collides with an object AND is the nearest to the player. When in open ocean you would have another audio source that would follow you from a few meters from the shoreline all along. I mean, it'd be automatic and not very expensive or time consuming. Tell me if you got a better idea or I am wrong. Thank you for aswering tho!  Not even working on the project I was using this library on but still glad to see someone is interested in this VERY GOOD ocean library.El 3 dic. 2021 21:14, Chris1234567899 @.***> escribió: Not beeing involved in the development here, but since I recently bought the hdrp version (awesome package guys!!) and focusing the same problem now, I thought about a couple of options here: The first idea would be placing or (auto)spawning several audio sources around the shoreline. Probably a bad idea, performance wise and sound blending wise. And also extremely time-consuming if done manually... So what we would actually need, is a single audio source that follows the camera. The primary source of sound are the waves from the shoreline, right? So we would need to check the distance from the camera to the shoreline. Luckily we already have data (somewhere?) on where the shorelines are, right? Could be from the depth cache, or maybe the foam layer, I don't know, but it must be somewhere. There is for example the GUI that shows different maps generated for waves, foam, clipping etc, so theoretically we could just run some image analysis to find the nearest shoreline and based on the distance, camera angle etc adjust the volume of the audio source. Alternatively, we could place the audio source directly to the closest beach instead of making it follow the camera. This is similar to the one mentioned before, also here we would have to detect the closest shoreline point, transform it into world space and position the audio source there. This would have the advantage of not playing around with the volume... maybe it would be more realistic. What do you think about that approach? Now another question is - do we need different sound tracks, for shoreline, open ocean, different wave sizes or wind strengths and if so (I guess we do), we would have to blend somehow between the tracks.

—You are receiving this because you commented.Reply to this email directly, view it on GitHub, or unsubscribe.