Lens Flare (FBX)
- Last UpdatedMar 12, 2025
- 2 minute read
Creating Lens flares
To create a Lens flare, create a Dummy object and initialize the Lens Flare parameters inside the Dummy user buffer.
-
Create as many lens flares as required.
-
The Lens Flare does not have a fixed conformation. In fact, it can be completely initialized through parameters. You can choose several parameters, including:
-
The number of flares (the 'circles')
-
Their transparency
-
Their position
-
-
Lens Flares do not work when PrintResolutionGrab is activated.
Defining a Lens flare
Every flare is initialized through a $ Flare structure.
All flares (the 'circles') must be in the same texture, so you must define which pixels to use for each flare.
To do this, you declare in the parameters a dimension of Reference (iRefWidth / iRefHeight), and then when you declare each flare you define where the pixels of the flare are relative to the Reference dimension.
Reference size can be any (integer) number. If required, you can also use 100 × 100, as long as the flare parameters are within these values.
Note: Lens Flares may not be visible in the very first frames. This is because visibility is calculated asynchronously. Visibility depends on the complexity of the scene, the card, and so on.
Scenario example
As an example, if the texture of the Lens Flare is 256 × 128, it is better to declare iRefWidth / iRefHeight as 256 and 128, and then to see for each flare which pixels to use. In this way, if I change the resolution of the texture, the Lens Flare continues to work because all the parameters are relative and independent of the texture.
Transitioning
The Lens Flare changes from visible to invisible in a transition so that the Lens Flare goes into fade and does not appear or disappear abruptly.
You can set the speed of this transition, using the fShowMul / fHideMul parameters.
The position (parameter fWhere) of each flare (the "circles") is relative to the Flare Vector.
Image example
As in the image using 0, the flare is in the middle of the screen. With 1, the flare is in the source position. Using values greater than 1, the flare goes beyond the source. Using values less than 0 the flare positions itself in the opposite direction of the source.

Code example
Code example for Lens Flare.
$LensFlare
{
iVersion = 1
szTexture = foxlensf.tga
fShowMul = 1.5
fHideMul = 1.5
iRefWidth = 512
iRefHeight = 128
$Flare
{
fWhere = 1
fScale = 0.2
v2Pos = 0 0
v2Size = 128 128
}
$Flare
{
fWhere = -0.5
fScale = 0.1
v2Pos = 256 64
v2Size = 64 64
}
}