This one is quick and simple. It shows you how you can create lens flares without having a lens flare plugin. It also teaches you some useful bits about expressions and texture parameters.

Up, up and away, in my beautiful balloon!

When is a square not a square? - Who cares...


Lets start off with a line, it seems as good a place as any. Draw a spline,a helix in fact. Make sure the helix has one radius of "0" and another of "1". We need to use a helix instead of a standard line because it's the only Max spline that has a length parameter.
Next draw a square using the rectangle tool. Apply a normal modifier to it. This forces the spline to become an object, and so creating renderable faces.

As we're going to be cloning this square it's best if we apply mapping now, so off you go! Slap on UVW co-ords - planar will do just fine, and make sure the gizmo fits all snugly.

"Lash me down, for I fear I will blow away...!"


Now the principals of lens flare are thus....
The flare elements lie on a line that is from the source of the illumination to the centre of the lens (and just beyond). This is a very simple explanation of what lens flare looks like, of course there are lots of other factors like shape of lens etc., but these things don't concern us here.

What we need to do then is work out the distance from the light to the centre of the screen. First of all we need a camera of course, or all of this banter is academic. Create a target camera in the scene, make sure to start with the target is fairly close to the helix. Next open up the track editor and find the controller for helix length. Click on the change controller icon and change it to "float expression", then call up it's properties.
If you've read my "boom banga bang" tut then you'll be familiar with the dialogue box that pops up. ...........Hang on I feel a segue coming on.........

SEGUE - Hold your horses fella! what are expressions anyway?


Expressions are mathematical formula that control how object parameters behave....Sounds good eh?
You can control any normal animation parameter and constrain it or influence it with the result of any other animation controller.
E.g. The amount of segments in a sphere based on it's distance from the camera.


Cut to the chase


Call up the expression dialogue box and enter this expression...

CONST+(POS1-POS2)

POS1 = position controller of the helix
POS2 = position controller of the Camera target
CONST = Constant variable the amount the helix should PASS the centre of the screen.

POS 1 and 2 should be created as vector variables, and CONST is a constant variable.

Part 2 of this is getting the helix to "look at" the camera target (and therefore the centre of the screen). For this we need to change the "transforms" controller of the helix to be a "look at" controller instead. The look at controller always points the objects -Z axis towards a selected object. Basically if you rotate the pivot foe the helix so that the Z (blue) arrow points directly along the line away from the camera target. This will probably involve rotating it 180 degrees.
When this is done you can change the transforms controller to "look at" by going to the motion panel and altering the controller there.

Use this roll down to choose the camera target as the look at object.

Home straight


When you've got your rectangle with mapping and your straight helix pointing at the camera target, you can start to clone the rectangles. Make as many as you need elements in your flare. When you've done that, scale some of the rectangles so that there more or less the sizes of the flare elements.

Now we have to get these bits to stick to the line - in an orderly fashion. For this we need to be using the path controller. Goto the motion panel and open up the controllers portion of the roll out. Select "position" and click the change controller icon -- and change it to read - Path.
You will then get, in the roll out below, this splendid dialogue box.....

click the pick path button and choose the helix.

MAX2 NOTE:- In max2 there is a spinner for % along the path, in Max1 there is not. So Max1 users will have to goto the track editor to change the value of the key.

Do this for all of the rectangles you made and space them along the helix.

"Look at me when I'm talking to you!"


Now it should look a bit like this....

But this is no good! Because lens flares are not objects and so are always flat to the screen. This, fortunately, is not too hard. For all of the rectangles you need to goto the motion panel and select "transforms" in the controller list. Then change it to read "look at".

"Iee lieek thur preeetee coolars, marmmy"


All thats left now is to apply the flare maps. These are the maps I used (but they were true colour and bigger, obviously).

Take each bitmap and make a material that is 100% self illuminating and has no shininess. In the "extended parameters" section make it an additive transparency - you will also need to change opacity to 99 to make it work. you shouldn't need to change any other parameters.

you should (if you set the bitmaps to display in the viewport) have something that looks a bit like this.....
The last thing to do is to link the helix to a light source.

And thats your lot. In practice you will probably need to render this effect out and then composite it over the top of your scene, because it will go behind objects. You will also have to tell the textures when to be visible and not, when the light goes off the screen. It's very rough an ready, but not too bad if you just need a simple flare for a one off and you don't have a plugin. But mainly it's a good way to play around with a few controllers and see the effects of additive transparency.

Until next time - lets be careful out there.