Q: Is there any freeware Lens Flare plug-in on the Web?


A: This is the look of ULF Beta 0.2:

This is the second part of the Tutorial. The Flare is going to work in 3D depending on the relative position of the Camera.Target to the Light Source, but its size will remain constant when you get closer.


Click here if you want to go to the BASIC TUTORIAL (ULF Beta 0.1)

Click here if you want to go to the ULF MAIN PAGE


Implemented in Beta 0.2:

  • The whole system is calculated in 3D coordinates and (almost :o) always remains perpendicular to the Camera. (some restrictions still apply).
  • Fixed Flare Size - When you go closer, the Flare keeps its size.
  • User Scale Control -. you can set (or animate) the size of the Flare without moving the camera.
  • Second set of rays. (streaks)
  • Twist applied for more natural Ray appearance.
  • Glow Ring
  • 4 Glow Layers instead of 2
  • More and better Secondaries

    HERE IS HOW ULF Beta 0.2 WORKS...

    (You will need the scene from the Basic Tutorial to do what is described here)

    Let's go 3D:

  • Create a Dummy Helper object..
  • Select the whole Flare System (excl. the Camera)
  • Group all Flare elements - Create a Group called Flare. (To be able to edit the Flare, you can Open the Group anytime later)
  • Make sure the Camera is aligned to the Flare - ULF lies in the XZ construction plane, the camera is perpendicular to it and parallel to the XY plane and points straight at the OmniLight.
  • Open TackView, find the Dummy, expand the tracks and add Euler XYZ controller to the Roatation Track..
  • Add an Expression Controller to the "X Rotation" Track.
  • Click on Properties (or right-click and select Properties)
  • Create two Vectors: "TCamera" and "Light"
  • Assign the Position of the Camera.Target to "TCamera"
  • Assign the Position of the Omni Light to "Light"
  • Enter the Expression for the Rotation of the Dummy about X:

    pi-(degToRad(atan((TCamera-Camera).z/(TCamera-Camera).y)))

    TCamera is a vector starting at World's Null Point and pointing at Camera.Target.
    Camera is a vector starting at World's Null Point and pointing at Camera position
    (TCamera-Camera) returns the Camera vector starting at the Camera position and pointing at Camera.Target
    ATAN from the Z-projection devided thru the Y-projection of the vector returns the Angle relative to the World Coordinate System. This Angle is converted to Radians (degtoRad) and substracted from 180 degrees (PI in radians).
    The Dummy is rotated at the same angle and stays perpendicular to the Camera vector.

  • Evaluate the Expression. (No changes should be visible because the Camera is aligned and the angle is 0!)
  • Now go to Z Rotation Track, create the two Vectors, and enter:

    pi-(degToRad(atan((TCamera-Camera).x/(TCamera-Camera).y)))

  • Evaluate the Expression.(No changes should be visible because the Camera is aligned and the angle is 0!)
  • Now select the Flare Group and Link to the Dummy.

    If you animate the Camera now, the Dummy and the linked Flare will try to remain perpendicular to the Vector "Camera-Camera.Target". The only problem occurs when the Y coordinates of Camera and Camera.Target are equal, bacause TAN(Alpha) is not defined for Alpha = 90 degrees. (Hope this will change in Beta 0.3... ;o)

    Now let's calculate the position of the Flare elements in 3D.

  • You will have to open the Position Track of each Flare Secondary and change its Expression to:

    [Light.x-(0.7*(Light.x-CTarget.x)),
    Light.y-(0.7*(Light.y-CTarget.y)),
    -Light.z+(0.7*(Light.z-CTarget.z)) ]

    Note that 0.7 is the Multiplier for a particlular Secondary, and varies for each expression. You can enter the expression once, save it or copy to clipboard, and load or paste in each expression field - you have only to change the Multiplier as it was in Beta 0.1

    There is a new Secondary on the other side of the Light now. You can create a copy and only change the plus & minus signs for X and Z in the expression:

    [-Light.x+(0.7*(Light.x-CTarget.x)),
    Light.y-(0.7*(Light.y-CTarget.y)),
    Light.z-(0.7*(Light.z-CTarget.z)) ]


    Now let's make the size of the flare FIXED!

  • Create a Star Shape in the Top Viewport.
  • Expand the Transformation Tracks of the Flare Group
  • Add an Expression Controller to the Scale Track
  • Create the Vectors "DummyPos" and "Camera" and assign to the Position Controllers of the Dummy and the Camera (NOT the Camera.Target!!!)
  • Create the Constant "Scaler" and assign to the 3rd Track of the Star Shape (Nuber of Points).
  • Enter the expression:

    [ (abs(DummyPos.y-Camera.y)+
    abs(DummyPos.x-Camera.x)+
    abs(DummyPos.z-Camera.z))/3
    *(Scaler/10000),
    (abs(DummyPos.y-Camera.y)+
    abs(DummyPos.x-Camera.x)+
    abs(DummyPos.z-Camera.z))/3
    *(Scaler/10000),
    (abs(DummyPos.y-Camera.y)+
    abs(DummyPos.x-Camera.x)+
    abs(DummyPos.z-Camera.z))/3
    *(Scaler/10000)
    ]

    When you change the number of points of the Star Shape using the Modifier Tab, the whole Flare System will be scalled. Once you have set a scale value, you can change the Camera position relatively to the Flare - the Size of the Flare will remain constant. Nothe that you can animate the Number of Star Shape Points and thus animate the scale of the Flare if you want to...


    All other changes to ULF in Beta 0.2 had to improve the visual appearance:
  • You should change the Object Properties for Shadow Casting and Receiving to avoid shadows from or over the Flare System!
  • You can add more Volume Light entries of different size and color to the Environment (Beta 0.2 "ships" with 4 layers of Glow).
  • Create a Ring Shape for the Glowing Ring.
  • Apply Extrude, add UVW coordinates.
  • Open the Group "Flare"
  • Select the Rays , press Shift and create a Copy.
  • In TrackView, select the "Modified Object" symbol of the Ring Shape, and click on "Copy to Clipboard".
  • Select the same symbol of the New Rays, and Paste the content of the clipboard - the Ring appears at the place of the Rays copy. (You can delete the original Ring Shape now)
  • Make sure that the Vector "Light" is assigned properly in the Position Expression of the Ring.
  • Play with the Material Editor and the Radial Gradient settings until you get a nice glowing ring. You can set a unique M or G channel to affect it in Video Post, too.
  • Copy the Rays Object again and set the Copy to generate many thin rays.
  • If you want a more realistic look, apply a Twist Modifier to the Rays, [80/-40/X]. The Rays will be twisted in 3D space and become not-so-regular.

    Click here to download the .MAX scene with ULF Beta 0.2.


    Bobo's Unreal Lens Flare (ULF)
    Copyrigh (c) 1997 by Borislav Petrov.
    Feel free to change, improve and distribute.