ocean sim tutorial

23
A Quick Start Tutorial for the Blender 2.56 Ocean Simulation Branch Build By: Todd McIntosh Date: March 14, 2011 www.savetheoceansim.com

Upload: james-ordner

Post on 26-Mar-2015

562 views

Category:

Documents


6 download

TRANSCRIPT

Page 1: Ocean Sim Tutorial

A Quick Start Tutorialfor the Blender 2.56 Ocean Simulation Branch Build

By: Todd McIntoshDate: March 14, 2011

www.savetheoceansim.com

Page 2: Ocean Sim Tutorial

Quick Start Tutorial for Blender 2.5 Ocean Simulation Branch Build

2

Mesh/Camera Setup

1. Open a recent build of the Blender 2.5 Ocean Sim branch, which can be downloaded at http://www.savetheoceansim.com/builds/

Page 3: Ocean Sim Tutorial

Quick Start Tutorial for Blender 2.5 Ocean Simulation Branch Build

3

2. Launch the Ocean Sim version of blender and delete the default cube.

Page 4: Ocean Sim Tutorial

Quick Start Tutorial for Blender 2.5 Ocean Simulation Branch Build

4

3. Add a plane mesh object.

Page 5: Ocean Sim Tutorial

Quick Start Tutorial for Blender 2.5 Ocean Simulation Branch Build

5

4. Scale the plane to 4 blender unit by 4 blender units.

5. Change to camera view (0 on the numpad).

6. Select the camera and adjust it’s position to achieve a low angle view on the plane mesh, and close in so that the mesh fi lls most of the camera (see reference image).

Page 6: Ocean Sim Tutorial

Quick Start Tutorial for Blender 2.5 Ocean Simulation Branch Build

6

7. Select the plane mesh. Choose the Object context and change the name of the mesh to OceanMesh.

Page 7: Ocean Sim Tutorial

Quick Start Tutorial for Blender 2.5 Ocean Simulation Branch Build

7

Ocean Modifi er

8. Keeping the ocean plane mesh selected, choose the Modifi ers context, and add the Ocean Modifi er.

Page 8: Ocean Sim Tutorial

Quick Start Tutorial for Blender 2.5 Ocean Simulation Branch Build

8

9. With the modifi er added, the mesh changes it’s size dra-matically (this will hopefully be fi xed). Hit the S key and the 0.04 to resize the mesh back down to it’s approximate size.

10. There is a range of waves sizes and levels of choppiness that can be realized. We’re going to go for medium to large waves with a fair amount of choppiness in this tutorial.

Page 9: Ocean Sim Tutorial

Quick Start Tutorial for Blender 2.5 Ocean Simulation Branch Build

9

11. On the Ocean Modifi er, ensure that the default settings are chosen. We leave the Geometry dropdown on the Generate setting. This keeps the mesh resolution in sync with the wave sim data resolution which we want.

12. For effi ciency we’re going to leave the RepeatX and RepeatY to 1. This feature replaces the functionality of the Array modifi er as we weren’t able to get the two modifi ers playing nicely together.

13. Change the resolution to 20, Choppiness to 2, and the scale to 4.

Page 10: Ocean Sim Tutorial

Quick Start Tutorial for Blender 2.5 Ocean Simulation Branch Build

10

Animation

14. Using the default 250 frames setting, move the current frame to frame 1, change the Time fi eld on the Ocean Modifi er to 0 and press I to insert a keyframe for the Time factor. Change the current frame to the last frame (250 in our example). Change the Time fi eld to 5 and press I to insert a second keyframe for the time factor.

Page 11: Ocean Sim Tutorial

Quick Start Tutorial for Blender 2.5 Ocean Simulation Branch Build

11

15. Click play on the timeline controller and you should see motion on the ocean mesh. We’ve set the resolution pretty high at 20, so you may want to reduce this resolution to get decent playback in the viewport.

Page 12: Ocean Sim Tutorial

Quick Start Tutorial for Blender 2.5 Ocean Simulation Branch Build

12

16. The default motion graph for the two keyframes has an acceleration and deceleration at the beginning and end that we need to change.

Page 13: Ocean Sim Tutorial

Quick Start Tutorial for Blender 2.5 Ocean Simulation Branch Build

13

Open the graph editor, select the Time(Ocean) factor and change the interpolation mode to Linear.

Page 14: Ocean Sim Tutorial

Quick Start Tutorial for Blender 2.5 Ocean Simulation Branch Build

14

Materials

17. We’re just going to start with a basic blue colour. Depending on the look you are going for, you’ll need more or less Mirror Refl ection. Photorealistic ocean material is almost a black with full refl ection, getting all the colour from the sky refl ecting in the material.

Page 15: Ocean Sim Tutorial

Quick Start Tutorial for Blender 2.5 Ocean Simulation Branch Build

15

18. With the ocean mesh selected, change to the Material context, add a new material. Change the Diffuse colour to Hex#143649. (Use any colour you want, this is what I used in the tutorial)

19. Change the Specular setting to 0.2

20. Enable Mirror and set the Refl ectivity to 0.1. Ensuring Ray Tracing is enabled in the Render settings and do a test render.

Page 16: Ocean Sim Tutorial

Quick Start Tutorial for Blender 2.5 Ocean Simulation Branch Build

16

21. Add a Sun lamp object positioned according to the reference image.

Page 17: Ocean Sim Tutorial

Quick Start Tutorial for Blender 2.5 Ocean Simulation Branch Build

17

Page 18: Ocean Sim Tutorial

Quick Start Tutorial for Blender 2.5 Ocean Simulation Branch Build

18

22. Enable the Sky checkbox in the Sky & Atmosphere section of the Sun lamp settings. Do another test render.

Page 19: Ocean Sim Tutorial

Quick Start Tutorial for Blender 2.5 Ocean Simulation Branch Build

19

Rendering a Test Animation.

23. At this point, we can render a test animation to see the wave motion. I’ve set my render output options to 35% of 1920x1080, 250 frames, and PNG output.

24. BlenderArtists.org is back online! Go to the forums and browse around while waiting for your frames to render! : )

Your fi le should look something like Ocean Sim Tutorial Video 1 (Vimeo) - http://vimeo.com/20231926

Page 20: Ocean Sim Tutorial

Quick Start Tutorial for Blender 2.5 Ocean Simulation Branch Build

20

Foam Mask Effect

25. With the ocean mesh selected, click the Generate Foam option on the Ocean Modifi er. Ensure the Coverage setting is set to 0. Change the End frame for the Bake Ocean section to 1. We’re

just going to bake 1 frame for testing. Check the Cache path to make sure it’s set. The default is //ocean_cache/. Click Bake Ocean.

26. Once the foam frame bakes, there will not be a noticeable change in the

viewport. To see the foam mask, posi-tion the cursor in the viewport, press the N key. Open the Display tab, and en-able Textured Solid. The mesh will turn a black and white colour, but the foam mask area will be apparent as the white area on the wave peaks.

Page 21: Ocean Sim Tutorial

Quick Start Tutorial for Blender 2.5 Ocean Simulation Branch Build

21

27. With the ocean mesh selected choose the Texture context. Add a new texture and choose the Ocean type. Name the texture FoamMask.

28. In the Ocean tab of the FoamMask texture, click in the Modifi er Object

tab and select the OceanMesh object. Change the Output dropdown to Foam. Choosing the Modifi er Object is critical as this ensures that the Ocean Modifi er and the Ocean texture is using the exact same OceanSim data, which will sync the texture with the wave displacement

from the modifi er.

29. In the Mapping section, choose UV for the Coordinates dropdown. Leave the Color setting at 1, and change the Colour selection to pure white.

Page 22: Ocean Sim Tutorial

Quick Start Tutorial for Blender 2.5 Ocean Simulation Branch Build

22

30. Do a test render of frame 1.

31. If you are happy with the test render, change to the Ocean modifi er panel, and click Free Bake. Change the End number to the last frame of the animation (250 in our case). Save your blend fi le, and click Bake Ocean.

32. When the bake completes, you should now have 250 displacement EXR fi les and 250 foam mask EXR fi les in the ocean_cache folder.

33. You should now be able to render the fi le with the foam

Your fi le should look something like Ocean Sim Tutorial Video 2 (Vimeo) - http://vimeo.com/20231977

Page 23: Ocean Sim Tutorial

Quick Start Tutorial for Blender 2.5 Ocean Simulation Branch Build

23

Author BioTodd McIntosh is a freelance web designer/developer based out of Markham, Ontario, Canada. A professional freelancer for the last 5 years, he is continually amazed at the rapid development that Blender has undergone over the recent few years. While constantly looking for ways to take advantage of Blender’s creative power in his professional design work, he is most excited about using Blender in his creative personal projects. He is passionate about the ongoing process of learning new techniques for 3d animation and is working on his fi rst short fi lm project “Reign of Fury” (Production Blog - http://www.reignoffury.com).

About the ProjectWhile searching for methods and techniques for rendering realistic ocean scenes for his personal project, Todd grew frustrated with the lack of workable solutions currently available at the time. In fact not only were there no realistic ocean tools, but there was an Ocean Sim build developed a few years earlier that was forgotten about. It never made it into the new 2.5 Blender re-code, and it was even diffi cult to fi nd old 2.4x builds with the Ocean Sim patch. On top of that, there were defi nitely no Mac OSX builds, which was his preference. Todd contacted Matt Ebb, an Australian 3d artist with Blender coding experience, who also had fi rst hand experience with the original Ocean Sim project. He enquired at the real-world development cost of porting the old tools into a Blender 2.5 branch. Because his animation project was a personal project, there was no budget to pay for the development out of his own pocket. However, buoyed by the wide spread interest by many other Blender artists, Todd decided to open the project up for community funding. Investing time and effort into designing a web site and blog for the new project, http://www.SaveTheOceanSim.com was born! The initial estimate of a straight port of the old Ocean Sim into 2.5 was approximately $350. After launching the site, that funding goal was reached within an amazing 24 hours from generous donors around the world. Encouraged by the response, Todd discussed new options with Matt and raised the donation level to $1500. The community, obviously excited about the project, met that funding level in less than a week. Eventually the community would raise over $2500US to put toward this project, including new research and development. This resulted in the new Ocean Sim Blender 2.5 branch, with realistic displacement and animated foam mask effect!

Base Ambient Ocean WavesThis is the base effect needed for all ocean shots. Using real-world based algorithms for generating the wave displacement, the water motion, and wave crests could be displaced out of the base mesh plane. This was what the bulk of our project was concerned with. The FFT noise algorithm is a substantial improvement over the current procedural textures such as the Cloud Texture because it accommodated multi-directional waves moving on a per-frame basis.http://www.vimeo.com/20231926

Foam EffectsMost foam effects are usually achieved via a particle system, the foam is a bubbly substance that fl oats on the waves and disperses away from the wave peaks and crests. Although Blender’s limited particle system is not able to allow us to generate foam in this way, we were able to fake the effect fairly effectively with a texture mask, that is pre-baked to achieve the dispersion effect. Hopefully in the future, this foam mask will enable us to generate the mesh locations for spray.http://www.vimeo.com/20231977

Peak SprayThis effect is generated by dynamically emitted particles from the peaks of the waves using the wave direction and velocity. This is currently impossible in Blender until the particle system is updated to work dynamically. The source of the particle emission is based on the wave peaks and velocity and needs to change continually on a per-frame basis. Exciting work on particle systems will hopefully allow us access to this effect in the near future. http://www.vimeo.com/8036664

Object InteractionThis effect simulates the interaction between an object, such as a ship, and the ocean mesh. It generates the wake displacement surrounding the object. Jerry Tessendor’s iWave implementation is a well known version of this feature. Although on our wish list, we were not able to get to this feature. Thankfully Daniel Salazar and Miika Hämäläinen have begun work on this feature, and it looks like it is being rolled into the Dynamic Paint project.http://www.vimeo.com/16710091

Wave Rigs (“Hero Waves”)Finally, the ability to have real control over a specifi c wave, such as a surf wave or tidal wave is achieved with a “Wave Rig” which has more specifi c controls for manipulating the way the wave is animated.http://www.vimeo.com/4698477

About 3D Ocean SimulationOne of the most apparent things learned during this project was the discovery of how commercial projects achieved the realistic ocean renderings that they did. Obviously, a physics-based fl uid simulation or a purely particle based solution with millions and millions of particles yield the most realistic effect (ie. Realfl ow, Naiad, etc.). However they are extremely computationally expensive, and decent results can be achieved with simpler methods. A mesh-based simulation has many benefi ts, not the least of these is rendering speed. In order to achieve the fi nal results, there are a number of effects usually layered together to get the desired effect.