New Ocean Techniques in Blender Creating large bodies of water in Blender 2.41 Part 4 By Cog aka Colin Litster Balancing Detail, and Painting with Light In this, the concluding part of my New Ocean Techniques Tutorial, I will cover the topics of balancing detail against render time and also ways in which a ray trace like look without the render time overhead can be achieved. We will also finish off our ocean by adding a bright morning sun and a simple panoramic cloud backdrop.
Flexible Modifiers Since Blender v2.40 the developers have added some very useful facilities. One of these is the new modifier system. This allows us to add mesh deformations in a non-permanent way. It also allows one to have a stack of modifications one after the other where you can not only change parameters but also change the order of the modifications. This is great because in our example it means we can try some subsurface modifications and experiment with the level and thus check the effect on render time.
Set a Subsurface Modifier With the ocean object selected go to the Editing button (F9) and select the Modifiers Tab and select Add modifier. From the displayed list of modifiers select Subsurf and initially set the render levels to 1. That’s the default lowest level, but it will double the render detail of the object. The levels option is the number of subsurfaces in screen mode. Since we cannot see the displacement until render it’s not worth setting this higher than 1. Optimal Draw makes it easier to see complex meshes in view mode.
Page 40
Created by Colin Litster February 2006
New Ocean Techniques in Blender How Much Subsurf? You can in fact go to 6 levels of subdivision but above 4 your computer will probably become unstable with such a large vertex mesh as our ocean. Below is part of a test render for each level up to 4 with timings. The actual render size was 1692 x 720.
,, As you can see the render time increases exponentially with each increase in Subsurf. Here is a graph based on those figures. What does that tell us? Well up to Subsurf level 2 there is only a 15% increase in render time. Go up to level 3 and it takes nearly 50% longer to render. Thus I wouldn’t go higher than level 2.
Page 41
Created by Colin Litster February 2006
New Ocean Techniques in Blender There is another reason to not go above Subsurf 2 and that’s the Far-sea object behind. It is only a 4 vertex plane so it’s very flat. As you increase the subsurface of the Close-sea object that flatness becomes more apparent, therefore breaking the illusion. All 3D modelling is a balance between achieving reality, or the artistic look you want, against the time available to achieve it.
Painting with Light Time to add some magic that will turn our current rather flat coloured ocean into a sparkling morning in the Mediterranean. Did you use a modelling light, as suggested earlier, to show the specular reflections on the waves? If so you could equate that light to a kind of Sun as it would have given very bright specular highlights centred from the location of the light.
Page 42
Created by Colin Litster February 2006
New Ocean Techniques in Blender One of the of the happy accidents that happen all the time in 3D is that this particular specular only light paints the top surface of the wave in much the same way as a raytrace reflection would. However, because it is a single light source it only lights a cone of specular light that comes to a point near to the location of its source.
Reduce Brightness & Duplicate the Light Blender has the ability to both fine tune the brightness, colour, and effect of a light source, as well as duplicate lights, or any objects in a scene. We will use these abilities to paint the surface of the waves from the horizon to the foreground. If you created a special modelling lamp move it to the following location. If you haven’t got one create a new lamp at this location. LocX: -97.884 LocY: 103.899 LocZ: 2.791 From its material settings (F5) and Lamp button set No Diffuse. Also set its Distance to at least 171. This ensures that the light will actually light from the horizon to beyond the camera. Render a small test image. As can be seen the light is very bright but it does stretch from the horizon to the camera. Now we are not after creating a Sun like reflection at this time so if we were to reduce the intensity of that lamp and duplicate it across the horizon we will produce a light painted specular illusion of raytraced reflection. Let’s start by duplicating the light across the horizon.
Page 43
Created by Colin Litster February 2006
New Ocean Techniques in Blender Duplicate the light on the horizon Your cursor should be on the single light you just created. If not select it and press SHIFTS for Snap and Cursor to Selection. From the camera view press SPACE, for Add and Mesh, Plane. Whilst still in Edit mode, locally scale the plane mesh so that it stretches across the horizon and the bottom edge is at the same height as the lamp recently created.
Now delete the top vertices of the plane. The easiest way to do this is to press BKEY, Border select, and middle mouse button (MMB) drag the marquee to surround the bottom vertices. When you release the MMB only the top vertices will be selected. Now press the XKEY to delete these vertices.
Page 44
Created by Colin Litster February 2006
New Ocean Techniques in Blender Subdivide the Remaining Vertices Reselect the remaining vertices AKEY and press WKEY and Subdivide Multi. The default is 2 subdivisions. If not set it to 2 and subdivide multi 5 times. This will produce a nice straight mesh with 244 vertices. Quite enough to Duplivert our light to. TIP: If you look in the top right of your Blender screen you should see displayed the current objects data. This will show number of Ve: (rtices), Ed:(ges), Fa:(ces), Me:(mory) used, and name of the object.
Duplivert the Lamp to this object Go out of mesh edit mode TAB, and reselect the lamp nearby. Now SHIFT Select the line mesh once more and parent it CTRLP. We can now setup a Duplivert for the line mesh which will copy our lamp to every vertex in our line mesh. Select just the line mesh RIGHTCLICK, on the line and from the Object menu (F7) select DupliVerts.
Page 45
Created by Colin Litster February 2006
New Ocean Techniques in Blender
If you were to do a test render now there would be so much light that the scene would be washed out. Fortunately each of these 244 lights just reference a single light. If we lower its level all others dupliverted will be reduced by the same amount. So select the single light that we just dupliverted and change its material settings to the following. As you can see the Energy level has been reduced to 0.010. I have also slightly altered the colour to try to match the light blue I use as a background. If you change the colour only make very small changes. Unless you want to create an out of this world ocean of course.
SAVE YOUR WORK HERE
Page 46
Created by Colin Litster February 2006
New Ocean Techniques in Blender Render a Test Image
Not bad. The line of low energy lamps, at the horizon, has added a subtle reflection like effect that helps define the detail in our waves. Time to add the finishing touches to our ocean. The Sun and cloud backdrop, and a horizon mist.
Page 47
Created by Colin Litster February 2006
New Ocean Techniques in Blender Creating a SUN Creating a Sun may appear to be a simple case of adding a single light source in a location matching where you sun should be. Unfortunately 3D light sources are much more precise that the natural equivalents. They emanate from a finite point in the 3D space and thus can look unnatural. We must therefore use similar tricks used to paint with the horizon lights to help spread the sunlight specular effect and help bloom out the Sun to make it look solar system size rather than pin-point. Create a lamp at this location:-
Now produce several instances of the lamp (ALTD) one after the other to widen the number of lamps seen by the camera. You will notice that they are placed a similar distance from each other as the horizon lamps earlier. We could have used the Duplivert technique but there are only a few lights and it’s probably quicker to just instance them. By the way if you set them too far apart the effect will look like lights in a line and not a single sun like specular light. As I we have about 8 lights here it will be necessary to reduce their energy a little or the effect will be too bright. So with one of the lights selected reduce its Energy to 0.500. Also select No Diffuse so that the light will only give specular highlights.
Page 48
Created by Colin Litster February 2006
New Ocean Techniques in Blender SAVE YOUR WORK Render a test image.
Things are coming along. Let’s now add a background and an additional light to give a nice bloom to the Sun.
Page 49
Created by Colin Litster February 2006
New Ocean Techniques in Blender Setting the World Select Material (F5), and World, and set the following settings:-
This will produce a light blue blend to almost white at the horizon. In our case that’s like a mild hazy morning in this part of our world.
Mist Blender has a rudimentary mist system that while not perfect (in fact I seldom use it), can help us produce the fading at the horizon a little. Since this is set from the World setting we might as well set it up now. From the Mist/Stars/Physics tab set as follows:Sta: 100.00, Di: 45.00, Hi: 0.00, Misi: 0.00
SAVE YOUR WORK
Page 50
Created by Colin Litster February 2006
New Ocean Techniques in Blender Sun Bloom Create a new Spotlight with the following location, and orientation. Then set its Lamp settings to that shown on the right below.
Note: You will see that the spotlight has been set with No Diffuse & No Specular effectively making the light invisible. However, the Halo is set and this will produce the bloom effect.
SAVE YOUR WORK Test Render the scene at this point.
Page 51
Created by Colin Litster February 2006
New Ocean Techniques in Blender
OK it looks a bit odd at the moment a kind of shaded sun. The Halo of the light has created an alpha mask for the sun and because there is no other object behind it, it defaults to a black background effectively adding the alpha value to the background we created a few pages back. We can overcome this odd effect by adding a huge tube object, with a nice cloud image mapped to it, centred at the camera. Select the camera and move the cursor to it. (SHIFTS), Cursor to Selected. From the top view Add a tube object. SPACE, Mesh, Tube, 32 vertices. Now scale it out in mesh edit mode to approximately just before the line of horizon lights.
Page 52
Created by Colin Litster February 2006
New Ocean Techniques in Blender And scale its Z dimension to approximately this. That’s just below the horizon and above the camera top field of view.
Still in Edit mesh mode select Set Smooth in the Edit button (F9). Map a new material to this tube with the following settings. NOTE: That Traceabl, Shadow, & TraShad are all turned off. This ensures that the tube will not block any lights behind it, or cause any shadows on the ocean. The material has also been set to Shadeless which will ensure that it will remain at full brightness no matter what. We still have 2 more settings for out tube material.
Page 53
Created by Colin Litster February 2006
New Ocean Techniques in Blender
The No Mist setting in the Mirror Transp tab is important as it will ensure that the world mist, we have set up, will not affect this tube material. Otherwise it would just disappear in the mist. We also have Col set and Tube mapping so that we can attach an image texture of our clouds.
Page 54
Created by Colin Litster February 2006
New Ocean Techniques in Blender
Attaching a Sky Image to the Tube For this exercise I’m not going to ask you to create a brand new cloudy sky image from scratch. If you would like to learn how to do so please read my:Cog’s Quick Tutorial No.5 Cloud Creation in Blender So here is a link to the image that I was used to create the renders you have seen in this New Ocean Techniques Tutorial. http://www.cogfilms.com/tutorials/new-ocean sky-27-07-05-03.jpg
Create a new Texture for our Tube material.
Page 55
Created by Colin Litster February 2006
New Ocean Techniques in Blender NOTE: because this image isn’t setup as a whole circular panorama image I’m repeating it in the Y axis so that it is not too elongated as it’s stretched around the tube. This does mean that there will be some joins in the texture but we can simply turn the tube around so that any join is hidden out of the field of view. If you wanted to pan your camera however, it would be best to have a 360° panoramic image mapped to the tube so that no join can be seen when the camera pans.
SAVE YOUR WORK Test Render the scene.
Page 56
Created by Colin Litster February 2006
New Ocean Techniques in Blender
There is our ocean. Render a 10 second animation (250 frames at 25fps) and admire your handiwork.
Taking things further Because the wave materials are mapped to a separate Empty. It’s possible to move the ocean meshes without moving the material. We can use this to help pan the camera without the need for a larger complex mesh under the camera as it pans. Just Parent the Close mesh and Far mesh to the camera. Then when you Pan the camera the mesh will apparently stay with the camera view but the material will move as though you are panning over it. You should also parent the line of horizon lights so that they pan with the camera. Well this has turned out to be a ‘big’ tutorial but I hope you will find it just a ‘little’ useful.
Page 57
Cog Created by Colin Litster February 2006