Ocean Simulation

January 19th, 2011 . 6 comments

I’ve been doing some work lately on ocean simulation tools for Blender. It’s based on Drew Whitehouse’s open source Houdini Ocean Toolkit, and on a previous patch that was made for blender. A few years ago at ProMotion when we were working on a short film ‘Lighthouse’, we hired Hamed Zaghaghi to make a patch for blender 2.4x, converting the HOT code from C++ to C, and using it to drive a texture in blender, which could provide displacement and foam outputs. In the state we left it in, it was a big improvement over previously available methods such as animated noise, though it was a bit rough around the edges, and since then the code was mostly neglected due to lack of time and interest.

I was asked by Todd McIntosh of Resonance Media if I was interested in restoring what could be salvaged of the old code and re-integrating it as a new patch for Blender 2.5, as a freelance coding project. Todd was able to get a good deal of additional crowd-funding, which really enabled me to spend the required amount of time on this. I was able to reuse some of the old patch ( mostly the C conversion of the main engine) however there was a lot of extra work and re-work that needed to be done. A fair bit of time was spent on making the simulation/evaluation thread-safe, since Blender 2.5 is much more multithreaded than previously, and just dropping in the old code was very unstable. Now the simulator sits as a separate ‘library’ inside blender that can be accessed from other parts of the software, and from a user perspective, there is now a new Ocean modifier, that can either generate an ocean mesh from scratch, or displace an existing mesh. The modifier adds correct UVs and if required, vertex colours to represent foam, for visualisation in the 3d view. I’ve also brought in multithreading to the main simulation engine, using OpenMP after seeing some example code here. I’ve written up some documentation online in the blender wiki.

Among the new features there’s also functionality to bake the simulation results (displacement/normal/foam data) out to a sequence of OpenEXR files. One of the reasons for this is to allow integration with external renderers. The sequence above was rendered in 3Delight with my blender->3Delight render exporter, using such baked files, with custom shaders (more info on the vimeo page). I’m currently just finishing off some final tweaks and bug fixes, and hopefully the tools should be released freely quite soon.

§ 6 Responses to Ocean Simulation"

  • woodn says:

    This is so cool, thanks Matt! Now i only have to get my sailing ships ready for this!

  • kilikoro says:

    —The sequence above was rendered in 3Delight with my blender->3Delight render exporter—
    After “save the ocean sim”, I ‘ll launch project “save the 3Delight render exporter”
    Nice job Matt

  • Matt says:

    kilikoro: it’s getting closer to release-worthy now, I’ve been able to spend a bit of time on it over the last couple of weeks

  • kilikoro says:

    Two good news on this morning!
    Thanks for your hard work Matt.

  • LoafMag says:

    “it’s getting closer to release-worthy now”

    Wow, that’s insanely good news! Care to share some more details? 🙂 Is it true that you’ll be working on Happy Feet 2 btw? If so, congratulations 🙂

  • Matt says:

    Bumping this, I’ve released a first version of the 3delight exporter. Still more to do, but something to play with now at least.

    And @loafmag yes it is true – thanks!

Leave a Reply

Your email address will not be published. Required fields are marked *

What's this?

You are currently reading Ocean Simulation at Matt Ebb.