..::electric gun::..
Lightning effects are normally best handled by a plug-in solution, but with a little effort and 3ds max 6’s new Particle Flow system, we can produce comparable results.
Even though there are one or two lightning / electricity-orientated plug-ins out there, they still can be quite expensive if you are only going to be using this type of effect in a single or couple of pieces. However, with the introduction of Particle Flow with 3ds max 6, we can generate our own lightning, and what better way to test it out than to blast the living hell out of something?! In this tutorial, we will produce an effective animation of a “lightning gun” purely out of particles, directly onto a provided background which was derived from a photograph of a hallway. With the 3D environment provided laid out to match the original background with the model and the camera positions matched, we will generate lightning arcs which will comprise of multiple particle systems or “Flows” all feeding into shared particle system events so they share similar features, such as generating scorch marks and interaction with the close proximity “walls”, showering the scene in sparks! We can then add an outline to suggest walls which will be rendered off using a Mental Ray Contour shader. We will then bring the rendered still back into 3ds max and use the standard Scanline renderer and render off the final image.
 |
Open the electric_start.max 3ds max 6 file included in the zip file. This scene has been created using measurements from the original environment where the photograph that was used to create the background composition was created, noting camera placement and settings to get the CG scene to match exactly. |
 |
Select the Hallway object in the scene and make a Reference copy, labelling it Arc Target. Add a Slice modifier and set the Slice Type to Remove Bottom. Rotate and position the Slice Gizmo to cut off the top of the mesh. Add extra Slice modifiers to remove parts of the mesh until you achieve something as illustrated. |
 |
Create an Omni light in the Top Viewport and rotate and position it as illustrated. Set its colour to RGB 32,94,220, Multiplier to 10 and Decay to Inverse with its Start to 0.03m. Enable Use And Show Far Attenuation and set the Start to 0m and End to 5m. Set the Contrast to 100. Go to frame 30, enable Auto Key and set the Multiplier to 15. At frame 32 set it to 20 and copy the resulting keyframe to frame 80. At frame 90 set the Multiplier to 0. Turn off Auto Key. |
 |
Back at frame 0, create a Vortex Space Warp in the Top Viewport. Set its Axial Drop Damping to 0, Radial Pull to 5000 and Radial Pull Damping to 100. Enable CCW. Click on the Align tool and align this Space Warp to the Omni light, using the Pivot Point options to position them. Link it to the Omni light and rotate the Omni as necessary so that the Vortex is pointing down the hallway as illustrated. |
 |
In the Top Viewport, create a Wind Space Warp. Set its Strength to 0, Turbulence to 5000, Frequency to 1 and Scale to 2. Create another Wind Space Warp, set its Strength to 0, Turbulence to 20, Frequency to 1000 and Scale to 0.01. Create a Deflector object and position it behind the Omni light as illustrated. |
 |
Still in the Top Viewport, create a Gravity Space Warp. Create a UDeflector Space Warp and add the Hallway object to it. Set its Bounce to 0.25, Variation and Chaos to 25. Create a Particle Flow system, label it Arcs-Targeted, set the Icon Type to Circle and align and link it (as before) to the Omni light. |
 |
Set its Viewport Quantity Multiplier to 100, Particle Amount Upper Limit to 100000000, and Render Integration Step to 2 Ticks. Press 6 to open Particle View. Rename Event 01 to Arcs-Targeted Generator. Set the Birth Operator’s Emit Stop to 100 and Amount to 40. Set the Position Icon’s Location to Pivot. |
 |
Set the Speed operator’s Speed to 10m with 5m Variation and a Divergence of 20. Remove the Rotation operator and replace the Shape operator with a Shape Facing operator. Set its Size to 0.01 with 100 Variation and set the Camera as its Look At object. Add a Material Static operator to the event. |
 |
At frame 0, add a Spawn test to the event, label it Spawn-Fork and set it to Per Second. Set the Offspring Variation to 100, Speed Divergence to 30, and set the Size Scale Factor to 75 with 25 Variation. |
 |
Add a Find Target test and set it to Control By Time. Set the Control By Time group’s Time setting to 3 with a Variation of 2. Set the Target to Mesh Objects and add the Arc Target object to its list. Set the Point setting to Closest Surface. |
 |
Add a Force operator to the event and add both Wind Space Warps to its Force Space Warps list. Set its Influence to 500. Add a Delete operator and set it to By Particle Age with a Life Span of 10 with 5 Variation. Add a Collision test, label it Collision-Character and add the Deflector01 object to its list. |
 |
Add an Age Test to the event, rename it to Age Test-Turn Off Gun and set it to Absolute Age. Set its Test Value to 80 with 0 Variation. Add a Collision test and label it Collision-Hallway. Add the UDeflector Space Warp to its Deflectors list. Add a Spawn test, label it Spawn-Trails and set its By Travel Distance to 0.005m and Inherited Speed to 0. |
 |
Drag out a Spawn test to the canvas to create a new event and label the event Impact Core Generator and the Spawn test to Spawn-Sparks. Set its Offspring to 200 with a Variation of 50 and Scale Variation of 50. Wire the input of this event to the Output of the Collision-Hallway test. |
 |
Add another Spawn test and label it Spawn-Scorch Mark. Add a Speed operator and set its Speed to 0m. Add a Shape operator and set its Shape to Sphere with a Size of 0.001m. Add a Material Static operator and a Delete operator. Set the Delete operator to By Particle Age with a Life Span of 15 and 0 Variation. |
 |
Drag out a Speed operator to the canvas to create a new event and label the event Sparks Generator. Set the Speed Variation to 0.2m with a Direction of Random 3D. Add a Force operator and add the Gravity Space Warp to it. Copy and “Paste Instanced” the Material Static from the Impact Core Generator event into this event. |
 |
Add a Delete operator, set it to By Particle Age with a Life Span of 25 with 10 Variation. Copy (not instance) the Collision-Hallway test from the Arcs-Targeted Generator event into this event. Set it to Collided Multiple Times and set the # Times setting to 2. Wire the Output of the Spawn-Sparks test in the Impact Core Generator event to the input of this event. |
 |
Drag out a Shape Mark operator to the canvas to create a new event and label the event Scorch Mark Generator. Wire the input of this event to the Output of the Spawn-Scorch Mark test. |
 |
Set the Hallway object as the Shape Mark’s Contact Object, enable In Local Space with Inherited to 5000 with 50 Variation, enable Impact Angle Distortion and set to 150 and enable Box Intersection. Set the Surface Offset to 0.001m and Offset Variation to 0.01m. Add a Material Static operator to the event. |
 |
Copy and Paste Instanced the Age Test-Turn Off Gun test and the Material Static operator from the Arcs-Targeted Generator event to the canvas to create a new event and label the new event Arc Life. Instance the Delete operator from the Impact Core Generator to this event and wire the input of the event to the Output of the Arcs-Targeted Generator’s Spawn-Trails test. Drag out a Delete operator to the canvas and label the resulting event Killer. Wire all of the Age Test-Turn Off Gun tests and the Sparks Generator's Collision-Hallway test to this event. |
 |
Copy the Arcs-Targeted root node and label the new copy Arcs-Random. Copy the Arcs Targeted Generator event, Paste Instanced it and wire it to the new root node. Label the instance Arcs-Random Generator. Make the Birth operator unique and set the Amount to 30. Remove the Speed operator. |
 |
Remove the Find Target test. Make the Force operator unique and set its Influence to 1000. Wire its Age Test-Turn Off Gun test to the Killer event, its Collision-Hallway test to the Impact Core Generator event and the Spawn-Trails event to the Arc Life event. |
 |
Copy the Arcs-Random root node and label it Beam. Instance the Arcs-Targeted Generator event and label the new event Beam Generator and wire it to the new root node. Make the Birth operator unique and set its Emit Start to 30 and Amount to 300. Make the Speed operator unique and set its Speed to 80m with 20m Variation. |
 |
Remove the Find Target test. Add a Scale operator under the Shape Facing operator, set its Type to Relative First and Scale to 10 with a Variation of 50 for all axis. Add a Force operator and add the Vortex Space Warp to it and set its Influence to 400. Wire the Age Test-Turn Off Gun, Collision-Hallway and Spawn-Trails events to the same events as before. |
 |
Copy the Beam root and label the copy Rays. Instance the Beam Generator event and label the new event Rays Generator. Remove the Spawn-Fork and Spawn-Trails tests, and the Scale and both Force operators. Wire this new event to the Rays root. |
 |
Make the Birth operator unique and set its Emit Start to 0 and Amount to 2000. Make the Speed operator unique and set its Speed to 1m with 0.5m Variation and a Random 3D Direction. Wire the Age Test-Turn Off Gun and Collision Hallway tests to the Killer event. Select all particle system icons and link them to the Omni light. |
 |
Open the Material Editor, label a material Hallway and assign it to the Hallway object in the scene. Hide the Arc Target object. Set the Self Illumination to 100 and add a Bitmap map to the Diffuse slot. Load in the background.jpg image in the zip file. In the Bitmap map, enable Environ, set the Mapping to Screen, expand the Output rollout and enable Invert. |
 |
Open the Render panel, change the renderer to Mental Ray, go to the Renderer tab and enable Contours. Expand the Mental Ray Connection rollout at the top of the material and add a Simply (contour) map to the Contour slot, set the colour to white, width to 0.25 and render off the image at 800x600. Save the image. |
 |
Change the renderer back to Scanline. Enable Self-illumination, replace the existing bitmap with the one we have just rendered, turn off Invert in its Output rollout and instance the Bitmap map into the Self-Illumination slot. Label a new material Arcs, enable Self Illumination and Additive Transparency, set the Opacity to 99, and set the Diffuse and Self-Illumination colours to RGB 32,94,220. Instance this material to the Material Static in the Arcs-Targeted Generator event. |
 |
Set the Arcs material’s Material Effects Channel to 1. Copy the material, label the copy Sparks and set the Diffuse and Self Illumination colours to white. Set the Opacity to 75 and instance this material into the Material Static operator in the Sparks Generator event. |
 |
Create a new material, set the Diffuse colour to black and add a gradient map set to Radial in the Opacity slot. Set its Color 2 Position to 0.14. Label this material Scorch Mark and instance it into the Material Static operator in the Scorch Mark Generator event. |
 |
Add a Lens Effects Render Effect and load in the Spotlight preset. Set the Lens Effects Globals Size to 50 and Intensity to 10. click on the Pick Light button and select the Omni light in the scene. In each Lens Effect element, set the Occlusion setting to 0. Add another Lens Effects effect, add a Glow element and set its Size to 10, Intensity to 40 and Use Source Color to 100. Click on the Options tab and enable Effects ID (defaulted to 1). Add 2 other Glow elements with Sizes of 5 and 0.02 and Intensities of 30 and 50 respectfully. |
 |
The end result is an effective electric effect, with the initial attracted arcs rushing to the nearest surface with a few random ones thrown in for good measure. The combination of the (inverted) background style, rendered lines and electric effects compliment one another. Try using parts of the particle system to generate other effects, such as a plasma ball or forked lightning travelling across the sky! |
 |
Download
the max file & maps! |
..::additional
tips::..
Background Image and Mental Ray #1
We have used an inverted version of the original image as dark colours work best with the bright lightning. If the lightning was rendered off onto the original light background, then the majority of it would not be visible! Producing the outlines is best suited to the Mental Ray renderer with its Contour shaders as this produces a very clean outline in comparison with the only other Standard Scanline renderer alternative, The Ink ‘n’ Paint material’s Inking which is lacking in quality
Mental Ray #2
We have used Mental Ray to produce the outlines, but have had to switch back to the Standard Scanline renderer as the post render effect glows and lens flares are not compatible with Mental Ray. Therefore we had to render off the background in one renderer and re-load it back into 3ds max (with Invert disabled) to use it in the scene with the glows. If Mental Ray allowed us to use the Glow effect, we could have rendered out the outlines and the particles in one pass. (It should be noted that the Glow effect does work in MR, but a MR message is reported contradicting this. It is also mentioned in the manual that Render Effects are not supported in MR, so use at your discretion.)
Particle Construction
The main driving force behind our electric system are the initial “Arc Generator” particles, which are individual particles that are greatly affected by two Wind Space Warps (to greatly randomise their motion). These individual particles, which move exceptionally fast and erratic, leave dense motionless particle trails thanks to a Spawn test. These trails then have a material assigned, with an Effect ID which tells the Render Effect where to assign the Glow.
Integration Steps
We have reduced the Integration Step for the particle systems for the interaction with the deflectors to be more accurate. Due to the speed of the particles, having a high Integration Step will result in the system not noticing that the particle has passed through the deflector. This also applies with the forked particle spawning; a too high integration Step will result in gaps in the trail while the system spawns the new particle. Lower settings results in a more accurate particle interaction, but longer render times due to particle preparation times, but because of the low amount of interacting particles, this will be negligible. As our Viewport has a higher integration step than the renderer (set in the particle system), gaps and collision inaccuracies will be visible in the Viewport. These will not occur at render time due to its lower integration step.
Particle Flow Wiring and Instancing
Thanks to the way that Particle Flow has been developed, we can wire multiple particle systems (the root nodes of each flow) into a single event. This is exceptionally useful with multiple systems like these, each of which would generate the same result if a particle from any of the systems should interact with the geometry in the scene – a scorch mark would be produced and a shower of sparks. We can also turn the gun off, therefore turning off (deleting) all particles apart from the scorch marks and sparks by using a Delete operator which is instanced across relevant events. If we were still working with the legacy system we would have to set up each system individually which would take an age!
Adding Extra Forks #1
The main beam is quite focussed, so therefore no arcs will escape from it, and (currently) any that do would be instantly deleted due to this system’s Beam Generator event’s UDeflector Collision test being wired directly into an event which deletes the particles directly on impact with the wall geometry. To create additional forks in this system, drop in a clone of one of the Spawn tests which generate the forks in one of the other events, and amend the parameters to taste…
Adding Extra Forks #2
…additionally, to create the wall impact scorch marks and particle debris, send the output of the Collision test to the event which generates the impact sphere, which the arc systems’ particles are passed to when they hit a surface. Just be careful how many forks you create else you may severely bog down the system! You can also improve and add more detail to the existing electrical effects by simply amending the attraction of the Find Target test – increasing the time will add more variation in motion, and by increasing the Spawn Fork’s Per Second value from the default value of 10 to, say, 15 or 20. This will add more forks to the system. Alternatively, increase the number of particles spawned so multiple forks are created at the same time. Again, be careful how many you create though as just by tweaking a setting can result in a very heavy amount of particles.
Initially
published: Computer
Arts magazine, Issue 94, March 2004.
Copyright
© Pete
Draper, March 2004. Reproduction without permission
prohibited.
www.xenomorphic.co.uk |