OK, pop over to Modeler and we'll create the Flag Object. There are a couple of ways to create the basic rectangular shape of the flag. You could establish (Make) Points at each corner location and then Make these into a rectangular polygon using the Polygon menu. You would do this after first selecting the Points in a clockwise (or anti-clockwise) order. If you wanted an irregularly shaped flag, using a large number of peripheral Points, this may be the best approach. For a regular, rectangular flag, the quickest method is to create a flat Box Object. The Box is a native Object format located within Modeler under the Objects/Create/Box buttons. But before we do any creating, let's make sure that the Polygons we generate are appropriate to the job in hand.
OK, now that's sorted, click the Box button. This puts the cursor into Box creation mode, so you can now draw a suitable Box outline in one or other of the View windows using the LMB. Logically, the outline of our flag should be seen in the Face window. I've dragged out a 2x1 rectangle 'cos that's the shape of the Union Jack image I intend to use on the flag surface. (There's more on the sizing aspect later.) You don't need any other dimension to the Box, so the other View windows show a simple line. The Box has no depth, it's just a flat plane.
OK, click the Make button to complete the job. You should have something like the following screen. Remember that we specified Triangles, so the flag is split into two. Perfick!
We now need to Subdivide these triangles into much smaller ones. The required wave motion will not be very lifelike if the flag has only two large triangular polys to do its stuff. So, click the SubDiv button under the Polygon menu. This pops up the Subdivide Polygons panel as shown below.
Leave all the settings at their defaults and click OK. The triangles will be divided into smaller ones. Here's what you get.
However, there are still not enough Polygons in the Flag Object to render a smooth, wavey surface. So, Subdiv a couple more times. More if you want to achieve a really smooth result. You should get something like the folowing graphic. Here, there are 512 polygons, but you may end up with many more. If so, be sure you have plenty of RAM and a fast processor! You can check the number of Polygons using the Stats button under the Display menu.
OK, I reckon this is good enough for an animation sequence. The next thing to do is to assign a suitable name to the flag's surface, so we'll recognise it when everything's transferred to Layout. Naming a Surface requires the area in question to be selected. However, since ALL our flag surface will have the same name, just go straight into he naming procedure. (The logic behind this is that LightWave considers ALL the Polygons to be selected if NONE are selected before the operation. Think about it!) You do the naming under the Polygon menu. On the left hand side, you'll see a button labelled Surface. Click this to pop up the Change Surface panel, shown below.
Enter an appropriate name for the surface to replace 'Default'. How about 'Flag Surface'...? You don't have to apply any particular colour settings 'cos we'll be applying an image map, which over-rides any colour values applied to the Surface. However, you should check the Smooth button to improve the render.
OK, the Flag Object is about done. All that's left is to Save it to LightWave's Objects directory under an appropriate name. I reckon 'Flag.lwo' says it all. Just click the Save button under the Objects menu and away you go. Now let's get into the interesting stuff!
Go back into the Objects panel and look for the 'T' button labelled Displacement Map. It's on the right hand side of centre. Click this to activate the Displacement Mapping functions. Here it is..
The Displacement Map panel will appear. This is where you select the procedural mapping routine you want, or nominate a Displacement Map Image. The latter will be accessible under the Planar Image Map option provided by the Texture Type scroll bar. You must have an image already loaded for LightWave to use it. You do that via the Images menu. In our case, we need Ripples. That's the procedural routine to create waves across the flag surface.
The Ripples control panel has various buttons with which you can modify the effect. Let's take a look at some of these controls.
The Opacity of a Texture is only relevant when you apply two or more different ones to the Surface. This can be done with LightWave 4 and above. The Opacity is the perentage 'contribution' any Texture has to the final surface appearance. With a single procedural Texture, leave this setting at the default 100%. OK, what about Wavelength?
Wavelength is the distance between the waves created by the pebble. A large rock thrown into the pond will create a large Wavelength. The waves will be big and well separated. A tiny pebble on the other hand would create smaller, more tightly spaced waves. Their Wavelength is smaller. So, Wavelength is the distance between two wave crests. That's easy enough too, but what's Amplitude?
Amplitude is (more or less) the wave's height above the pond surface. In the real world, a large Amplitude ripple is usually associated with a large Wavelength and vise versa. With LightWave, you can create large Wavelengths with small Amplitudes (like oceanic swells for example) and vise versa. However, if you overdo Amplitude, the waveform will become terribly messy. Start with very small settings and work upwards. You can also vary the Amplitude over time by using the Envelope ('E' button). It all adds to the fun of Ripples! But what about Wave Speed?
Wave Speed is the rate at which the waves spread away from the Center. It's defined in distance units per anim frame. In real life, the speed is determined by the physical characteristics of the medium transmitting the Ripples. That is, the water, the air, the oil, the melted cheese, or whatever other gloop you can imagine. It's controlled by things like density and viscosity. In LightWave, you can make the Wave Speed whatever you like. To get a good looping animation, you'll need to spend some time on the Wave Speed element. The start and end of a loop sequence should be the same, so you don't see a 'join'. With Ripples, the wave crest at the end of the loop should be just about where the start position was.
The easy way to figure this out is to first decide how many frames you wish to use for the loop sequence. You should really set that initially, using the Scene menu. Here, you can fix the number of frames in the animation and other stuff (which are probably best left at default values). Once you've fixed the number of frames in the loop, it's time to estimate the Wave Speed. For the mathematicians out there, it's clear that the wavelength should be divided by the frame number. That way, the start and end frames will appear similar. The answer to this division is the Wave Speed. It inevitably requires a little tweeking in practice, but that's the gist of it. OK, let's talk about the number of Sources.
Sources is a bit more complex. Imagine two or more pebbles hitting the pond surface at the same time. They all have the same Centre, Wavelength, Velocity, etc., but they transmit their waves with differing vectors. In essence, you get a mixing effect. In some places, the waves will reinforce one another, in others they negate one another. The result is a more complex pattern of resultant waves. The larger the number of Sources, the more complex (and slower rendering) is the effect. Numbers should be kept fairly low, six or less. Large numbers add nothing to the result other than slowing down the render speed. For our waving flag scene, a single Source is best.
The only other parameters of note are the Texture Size, World Coordinates and Falloff buttons. The Size parameter is probably the most important of these. It's related to the overall size of the Surface being textured. The default values are usually about right. LightWave does a reasonably good job of matching the size of the Texture to the size of the Surface. However, if you wanted to make the Texture very small or very large in relation to the size of the Surface, this is where you'd do it.
If you check World Coordinates, the Texture mapping routine is 'locked' into the Layout grid coordinates, rather than the Surface's. This means that the Texture will not move 'with' the Surface as the Object moves. The Surface will appear to 'move through' the stationary texture. Wierd!
Falloff determines whether the Texture will 'fade away' with distance. It's expressed as a percentage reduction per unit of distance from the Center. This would be activated if you were trying to simulate real ripples on a pond. The wave gets fainter as the distance away from the Center increases. OK, let's talk about flags!
For National Flags, a good source is the World Flag Database. From here, you can download whatever takes your fancy. They're all in .gif format, so Amigans will need to convert these into .iff or .jpeg format before use.
The database gives details on the height to width ratio of every flag. You'll be surprised to see how they vary! Anyway, if you want your waving flag animation to be a true representation, make sure you note the size ratio. This should then be applied to the flag mesh we made earlier. Just load it back into Modeler and use the Stretch tool (under the Modify menu) to make the ratio correct. If you don't do this, the flag image may appear too squashed or stretched out.
As I said at the start, I'll be using the Union Jack. This has a 2:1 size ratio (as we designed in Modeler) so the flag image will fit perfectly onto the Surface. Here's the image I downloaded from the database.
Click the Load Image button to get a file requester. Here, locate the desired flag image and away ya go!
The next task is to tell LightWave to use this image as a flat map on the surface of the flag object. So, click the Surfaces menu button. This pops up the Surfaces panel, with which you can apply the image as a Planar Image Map to the 'Flag Surface' we defined earlier. Here's the panel being used to project the image along the Z axis. That's the direction we'll be viewing the flag, so make sure you select the correct axis for your application. For some insight on projection axes, check out Tutorial 3.
Other parameters to note are the Height Repeat and Width Repeat buttons. Deactivate these so you won't get any wallpapering of the image. The image must fit perfectly over the flag surface in 'one go'. Ensure this by clicking the Automatic Sizing button. LightWave will then stretch any image to fit the Surface if necessary. Making the flag the same size ratio as the image will avoid this, of course.
The next thing to do (if you haven't done it already) is set up the Ripples texture for the Flag.lwo. Go back into the Objects panel and click the Displacent Map button as described earlier. The pop up panel allows you to set the various Ripple parameters we've already considered.
This grab shows the Center setting pop up panel. I've placed the ripple Center to the upper left of the Layout stage. This will cause the waves to progress across the flag from top left to bottom right. You can ring the changes on this to suit your application.
When you exit the Displacement Mapping panel, you'll see that the wireframe of the flag.lwo is already being textured by the Ripples routine. If you run a Preview animation render, you'll see how the wave action actually works. Here's what you should see if your Ripple parameters are about right.
When you run this test animation, you'll probably see a glitch as the loop recycles to the start. The easiest solution to this is to change the Wave Speed. Subtle changes to the Wave Speed setting will let you see the direction to go and you'll quickly get things looking OK. When you're happy with the Preview, it's time to sit back and let LightWave do it's stuff.
So, go to the Record menu and set up the image format/anim type and the path for storing your rendered animation or frames. Check the Camera menu to see everything there is to your liking and click the Render button, go for a cup of tea, or take the dog for a walk, depending on the power of your machine. At some stage thereafter, you should get output something like this:
For use on a webpage, you'll need to convert the animation into Gif format. Alternatively, pop over to the Downloads Page, where you'll find umpteen examples ready to use. Now what's the weather like outside? Is the wind blowing?
Go back to the top
Go to Tutorial 1
Go back to the Tutorials Page
Other LightWave Sites