Dev:Source/Textures/Ocean Tools

提供: wiki
< Dev:Source‎ | TexturesBlenderDev/OceanToolsから転送)
移動先: 案内検索

Notes on Ocean Simulation

The studio I work for (ProMotion Studios) just started pre-production on an animation project that will involve shots of an ocean, waves, and spray. We will be using Blender. Crashing waves and spray can probably be faked a lot with particles etc, but there doesn't exist a good solution at the present for simulating bodies of water such as a choppy ocean.

Updates

  • Update 15/02/2008 'Simon' emailed with a basic C code skeleton, converting python to C syntax, but without numarray or fft functionality: Blender_Ocean.c

Requirements

  • So far it seems like it would be best implemented as a texture, that we can feed into a displacement modifier/bump map
  • It would be great if the texture provided other outputs, containing different data out of the sim than just a height field. This extra info would be used as masks in shading to colour the waves for foam etc, and/or to drive generation of spray particles. In the current texture architecture, this could just work as different 'modes', but might be interesting later as different outputs on a texture/shading node.

Research so far

I realise that there has been an 'ocean simulator' project by Simon Harvey ongoing for a very long time (with threads dating back to 2004 on the blender.org forums). However, as far as I know, there was never any code released, and the project seems to be abandoned and has lost direction to ideas of plugin architecture for Blender. We need a solution within the next month, and this doesn't look like it will be ready for what we need by then.

I've looked at a few papers, and game engines with sample code etc, and the most promising so far is the Houdini Ocean Toolkit. Quoted from their website:

The Houdini Ocean Toolkit (HOT) is a collection of dso's and an OTL for rendering deep ocean waves using the algorithms of Jerry Tessendorf described in the SIGGRAPH 2004 course notes.


HOT is an open source (GPL) set of plugins and shaders for generating oceans in Houdini. While the plugin itself is C++, and pretty specific to Houdini, part of the package includes a standalone prototype python script that can be run from the console to generate an image sequence of height fields. While this may not be as complex and powerful as the Houdini plugin itself (I don't know), I've done some very quick tests, and am already getting pretty promising results with it, used with a displacement modifier applied recursively (to get the nice choppy peaks). It would be great to convert this script into a form that can be used as part of Blender (such as a procedural texture).

Blender render of the script output used as a displacement map Ocean03.jpg

packed example .blend file

Animation (h264)

Example of a generated height field from the python script Height0001.jpg

While this is working ok so far as a test, it would be much better to have this functionality within Blender, for a number of reasons:

  • Usability and interactive control over the settings, such as wind direction/velocity/etc
  • Procedural generation - i.e. no need to store and send enormous image sequence to render farms
  • Data overload when trying to use additional image sequences for foam generation/shading masks etc
  • More future-proof, benefits for future projects/users of Blender

The script itself seems relatively simple, using the numarray and fft modules. It's less than 200 lines of code and a lot of that is just setup, and code to write out the images using the Image module. I would potentially try converting it to C myself, but I'm not too familiar with the theory behind it (such as FFTs) and would probably have troubles fixing it if it didn't work properly.

I'd imagine for someone already familiar with such concepts, it shouldn't be too difficult to get this running in C code that can be included in Blender. I can help with UI and blender-side integration code, too.

Doing the work

If anyone thinks they can help, please contact me at matt (at) promotionstudios.com . We have budget available to sponsor this work, we can discuss rates over email.

I'm also often in IRC on irc.freenode.net #blendercoders as 'broken_work' or 'broken', mostly during Australian business hours and would be more than happy to discuss this as soon as possible.

--Matt Ebb 01:37, 15 February 2008 (CET)(Sign)