Extension of Photon Mapping using Photon Magenets
By: Doug Kavendek

Motivation:

    Typically, photon mapping is designed to be as realistic as possible.  However, there can sometimes be artistic reasons to modify how light behaves so that while a scene seems to appear realistic, it is not actually following strict lighting rules.  For this project, I have attempted to implement a Photon Magnet object, through which the user can manipulate lighting with a higher level of control.  This has been implemented within POV-Ray (Persistence of Vision Raytracer), and is controlled easily within Moray (a modeller for POV-Ray scenes).

Implementation:

    Before explaining the basics of this project, I need to explain the interaction between POV-Ray and Moray.  Within Moray, a user can create a scene, create textures and models, and then export the scene to POV-Ray for rendering.  Moray converts its own objects into objects in a scene file, which is then parsed by POV-Ray.
    I have created a new object within POV-Ray, with which I can manipulate photons.  While it is possible to create and use such objects from within POV-Ray entirely, it is much easier to visualize the placement of objects in Moray, so I have created a plugin for Moray that allows the user to add and modify such objects.  When rendering a scene, Moray then converts these objects and their configurations to the appropriate tokens for POV-Ray.

Description:

    Each Photon Magnet object is affected by each photon-emitting light in the scene.  Depending on its attributes, it will interact with these photons. 

    Target:   Independent of the Photon Magnet's position, it will attempt to fire photons at this target position.

    Radius:   De pending on the Light Type, this will either affect the size of the target area, the size of the starting area, or both.

    Light Type:   Determines the shape and pattern of photons fired from the Photon Magnet.  "Cylinder" will fire photons in a cylinder, with the starting and ending positions distributed about the given radius.  "Spotlight" will fire all photons from one point, into a space distributed about the target.  "Focus" will distribute the starting positions of all the photons, while aiming them towards a single point. See images.

    Base Photons:   The base number of photons that a Photon Magnet will try to direct towards its target.  The default value is 10,000.  Increasing this value will create a more concentrated and brighter light, while decreasing it will leave the target dimmer.  Using a value too low can make a choppy (not conical/cylindrical) light, as the photon spacing will be too sparse.

    Strength:   For each photon being fired from the Photon Magnet, the strength will determine how many photons to launch from this location.  This number can be seen as a percentage, such that numbers greater than one have a greater chance at firing more than one photon, and less than one will give a 1-strength chance of not firing a photon from that location at all.

    IStrength:   Be default, when a photon is chosen to be fired from the Photon Magnet, the original photon will continue on it's way unaffected.  However, it may be useful to have the original photon not continue on its course, simulating that it's been redirected.  Values from zero to one will redirect that proportion of photons, and negative values have the opposite effect (actually resulting in more original photons).  These are not physically realistic effects, but do give you more control over the scene. See images.

    Color:   The color of photons fired from the Photon Magnet.  The color of the photons can also be controlled by assigning a filtering material to the Photon Magnet.

    Falloff:   Affects the distribution of starting/ending points of photons within the given radius.  A value of one will cause an even distribution.  Values less than one and greater than 0.3 will focus the points towards the center, and values greater than one will focus the points towards the outer edge of the radius.  Using values greater than one are not physically realistic, but can be used for interesting effects, such as simulating caustics. See images.

    Pass Through:   For some effects, other lights in the scene may cause unwanted artifacts around the Photon Magnet's position, so it may be necessary to set this value to one, so that other lights do not interact with it.  However, this seems to have an adverse effect on the number of other Photon Magnets allowed in a scene (no more than two, total).

Usage:

    In Moray, simply add a Photon Magnet, move it to the desired location, and set the target postion.  In order to get a plain white spotlight, you do not need to change any of the settings.  However, there must also be some kind of photon-emitting light within the scene, and its distance of this light from the Photon Magnet will affact how bright the Photon Magnet becomes.  Sometimes it is preferrable to have a light source close to the Photon Magnet so that it produces a bright light, but the user does not want to actually have a bright light visible within the scene - in this case, I have implemented an additional object (a Photon Magnet Light) in Moray that functions as a photon-emitting light, but does not cast any light within the actual scene.  It is visible as a tiny cube, so it is advisable to position this object close to the Photon Magnet, but outside the view of the camera).  No additional parameters need to be assigned to this object, as it will, by default, emit photons.  The user can, however, scale the object smaller in order to make it less visible, if necessary.
    While it is sometimes useful to give the exact coordinates of the target of the Photon Magnet, it may sometimes be desirable to just aim it by hand.  In this case, the user can use the rotation and scaling transformations on the Photon Magnet.  After applying a transformation, Moray calculates the new target position, and then resets the Photon Magnet's transformations.  In this way, transformations are not cumulative, and the position of the target is immediately visible within Moray.  Combining this with the incremental movements available by using the scroll buttons for each of the target's coordinates, it is very simple and intuitive to position a Photon Magnet's target.  Additionally, the user can translate the Photon Magnet around, and it will continue to aim towards its given target, so that moving the Photon Magnet does not require any adjustments to aim it right again.

Images

   Effects of Light Type

   Light source examples. The light is coming from the upper right, hitting the surface at a steep angle to emphasise differences.
Cylindrical light source - oblong shape due to angle, but continuous edges. Spotlight light source - edge bleeds in lower left due to spreading light.
Focus light source (with target before surface) - stronger edge bleeding due to higher spreading of light after focal point. Focus light source (with target after surface) - very tight edges with high edge continuity, due to focusing of light.
   As can be seen, the spotlight and cylinder light types behave very similarly to regular light sources, but the focus light types deviate from this. By positioning a focus light source's target after a surface, the user can create a tightly focused light patch, and by positioning it before a surface, it will spread the light more.

   Effects of iStrength

   These examples illustrate what can be achieved using different iStrength values.
iStrength=0.0 - No effect on other photons. iStrength=0.5 - Photons are half as strong. iStrength=1.0 - All other photons are gone.
iStrength=-1.0 - Normal photons are doubled. iStrength=-2.0 - Normal photons are tripled. iStrength=-3.0 - Normal photons are quadrupled.
   By using negative values, the user can increase the brightness of other photons, or by using positive numbers, the photons can be dimmed.

   Effects of Falloff

   Falloff does not change the side of the beam of light, but changes the concentration of photons within it.
Falloff=0.5 - Photons are concentrated towards the center. Falloff=0.75 - Photons are spread out a bit more, but still are centered. Falloff=1.0 - Photons are spread evenly, but due to sphere being projected to 2D surface, photons still appear more concentrated towards center. However, the distribution is even, and follows what would be expected of a sphere.
Falloff=2.0 - Photons start to concentrate near edges. Falloff=4.0 - Photons gather more strongly near edges. Falloff=8.0 - Photons gather primarily by edges.
   Using values between 0.3 and 1.0 for Falloff seem to result in realistic beams of light. However, it is possible to use values greater than 1.0 in order to create interesting effects. One use of this effect is in Faking Caustics

   Faking Caustics

   One interesting use of Photon Magnets is to simulate caustics that wouldn't be physically possible, either to achieve an artistic effect, or to simply have more control where the caustic hits.
Scene without any caustics. Scene with natural caustics formed from wine. Simulated caustic with Photon Magnet, with large falloff (~300).
Combination of simulated caustic, with natural caustics. Enlarged simulated caustic. Smaller, concentrated simulated caustic.
Simulated caustic with material that has dispersion. Simulated caustic with material that has IOR greater than 1.0. Simulated caustic with smaller falloff (~0.5).
Interesting curled effect, using Focus light type. Curling effect, more pronounced with higher Falloff. Multiple simulated caustics.
   While the simulated caustics do not resemble the natural caustics, they can still appear pleasing, and with the added control, can be useful to achieve certain effects.

   Highlighting

   Another use for Photon Magnets is to quickly and easily provide a highlight to objects within a scene. With these examples below, the highlight was switched between different targets using minimal effort.
   

   Moray

   Using Moray to manipulate the Photon Magnets.
Cylinder light type. Spotlight light type. Focus light type.
   It is easy to see the exact shape of the cone that a Photon Magnet will create. To see the manipulation of Photon Magnets within Moray, download this video.

   Miscellaneous

   Other uses of Photon Magnets
Multiple Photon Magnets hitting the same point. This is very easy to achieve, and doesn't require much work to have them aim at precicely the same point. There are separate colors visible at the edges due to the shape of the beams striking the surface. Light from a Photon Magnet (from the right) can both be refracted and reflected, just as normal light would. An example scene with several photon magnets. One simulates light coming from the blue object near the ceiling, one is highlighting a sphere, and one is lighting up a block on the shelf.
   


Conclusions

While there are many things that can be done with regular lights just as easily as Photon Magnets, there do remain some things that Photon Magnets can only do, such as the result of using a Falloff greater than 1.0. Additionally, there are several things that are much easier through Photon Magnets, such as aiming lights at exact points, regardless of the position of the source of the light. The user can also create, using the focus light type, the kind of light that would only be possible by physically creating an object to focus a regular beam of light (and which becomes trivial, using Photon Magnets). Also, the user can rotate Photon Magnets in the same way as regular spotlights.