Legacy Reference

Lightning Arc Entity

This topic references tools and features that are legacy. If you want to use legacy tools in Lumberyard Editor, disable the CryEntity Removal gem using the Project Configurator or the command line. To learn about the latest features, see the Amazon Lumberyard User Guide.

You can use the Lightning Arc entity to creates realistic electric arcing and sparking effects in your track view cinematics and levels.

Material Setup

It is recommended to use a diffuse texture, transparency = 99, additive mode, with a slight glow, and using the Illum shader. The arc warps around the U coordinate and uses the V coordinate as a multi-frame animation.

Lightning Arc Parameters

Property Description
Active If set to true, it automatically starts sparking after jumping into the game.
ArcPreset A valid preset must be given. This defines how the lightning arc looks.
Delay Delay in seconds between sparks.
Delay Variation Time randomization in seconds.

To set up the ArcPreset visual effect, open the Libs\LightningArc\LightningArcEffects.xml file and make desired changes. When finished, reload the g_reloadGameFx console variable.

ArcPreset Parameters

Property Description
lightningDeviation The smooth snaky effect given to the lightning in meters.
lightningFuzzyness The noisy effect given to the lighting in meters.
lightningVelocity After a spark is triggered, it starts to shift from its original position upwards.
branchMaxLevel Should be kept at either 0 or 1, but either value can be used. However, it also allows child branches to strike out of the main beam and child sparks to branch out of other child beams if this value is 2 or higher.
branchProbability Probability that a child sparks from another beam segment. If set to 0, no branch is generated, 0.5 is a 50% probability of sparking a branch, 2.0 is a probability of sparking 2 per beam, and so on.
maxNumStrikes Hard limit on the number of beam segments that can be generated regardless of previous parameters.
strikeTimeMin Minimum time a spark is kept alive.
strikeTimeMax Maximum time a spark is kept alive.
strikeFadeOut When the spark dies, it takes this time to fade out into oblivion. It decreases beamSize to 0 instead of actually fading via transparency.
strikeNumSegments Number of snaky segments generated.
strikeNumPoints The number of actual segments generated is defined by strikeNumSegments* strikeNumPoint. When the code generates the geometry, it creates a camera/beam-aligned quad with exactly 2 triangles. This means that the number of triangles per strike is going to be strikeNumSegments*strikeNumPoint*2. Because maxNumStrikes is the hard limit of potential number of sparks active at any time, the potential number poly count of a given lightning effect is going to be strikeNumSegments*strikeNumPoint*2*maxNumStrike. However, remember that every time the LightningArc entity strikes, a new lightning effect is going to be triggered and therefore the total poly count of a given effect can go higher. The game has a internal hard limit for the total amount of lightning effects, lightning strikes, and poly count that cannot be surpassed; otherwise, geometry starts to disappear.
beamSize Width of the beam being generated. Child beams have half the width.
beamTexTiling exture tiling depends on the world size of the actual beam being mapped. A value of 2.0 means the texture wraps around twice every meter. A value of 0.25 means the texture warps around every 4 meters. Only the U coordinate of the texture map is affected by this parameter.
beamTexShift The U coordinate moves in a given direction at this value's rate. While beamTexTiling only affects the U coordinate, the V coordinate is automatically calculated to select one of the texture's frames.
beamTexFrames Number of frames in the animation.
beamTexFPS Frames per second of the multi-frame animation.

Using Flow Graph

The entity:LightningArc node is used for creating special arcing effects.

entity:LightningArc node I/O ports

Port Description
Enable/Disable Allows to dynamically enable or disable the internal timer.
Strike Allows to manually trigger a spark even when the entity is disabled. This allows synchronization of the spark effect with other level events.
EntityId The entity that was last struck.
StrikeTime The time the last spark takes to fade out.

Parameter Reload

Since the lightning effect is implemented using the Game Effects gem, it is possible to reload all parameters during runtime using the g_reloadGameFx console command.