Env lensflare

It creates a cinematic dynamic that can be used to represent bright light sources.
Represented by class CLensflare.
==Keyvalues==
 
See below for more details.
Sets scale of intensity in three independent numbers, used number depends on the player's camera deviation.
: First number sets when player look at entity center. 
: Second number sets when player camera have slight deviation.
: Third number sets when player look far away from entity center.
Sets scale of size in three independent numbers, used number depends on the player's camera deviation.
: First number sets when player look at entity center. 
: Second number sets when player camera have slight deviation.
: Third number sets when player look far away from entity center.
 
==Inputs==
==Flags==
==Lens Flare Properties==
An individual can support up to 20 flares. Each flare have different properties that can be customized.
===Texture===
The texture property sets the material used by the flare. It is a path to a VMT file relative to the materials folder, without the file extension. Common flare materials are located in the effects/lensflare/ folder. Any material can be used as a lens flare, but flare materials should preferably use and be .
===Parameters===
The parameters property controls the appearance of the flare. Parameters take the following form:
TYPE parameters
The following lens flare types can be used:
====DISK====
A screen space flare that gets stronger when the player looks directly at the , and weaker as the player looks away. It takes three parameters.
The first number - how strong a image will move away from screen center. With 1 it will attached to screen center. If 0 - will stay at center. Negative number will mirror effect that do positive number.
The second number - distort a image along the axis Y. Doesn't work with negative numbers.
The third number - distort a image along the axis X. Doesn't work with negative numbers.
====BOW====
An effect that uses an image and distorts it between center of screen and center. It takes one parameter. Doesn't work with negative numbers.
The first number - change a picture scale.
====CLA====
This effect looks like copy of DISK. It use same parameters.
====DISKH====
An effect that uses an image and moves it along the X axis. It takes four parameter.
The first number - how strong the image will move away from screen center along the axis X. If number is 0 - it will stand at center. With 1 it will attached to screen center. Negative number will mirror effect that do positive number.
The second number - distort the image along the axis X. Doesn't work with negative numbers.
The third number - distort the image along the axis Y. Doesn't work with negative numbers.
The fourth number - change position of a image along the axis Y. If positive number - be higher, if negative number - be lower.
====RAY====
An effect that uses an image and scale it. It takes two parameter. Doesn't work with negative numbers.
The first number - distort the image along the axis Y.
The second number - distort the image along the axis X and Z.
===Lens flare creation tips===
There is no preview in Hammer for lens flares, there is also no UI editor for lens flares. The developers recommend to use their lens flares, or use their lens flares as base for your own. You can create your own lens flares from scratch by following these steps:
* 1. Open the developer console.
* 2. Enter in the console sv_cheats 1.
* 3. Enter in the console ent_fire YourLensFlareName addoutput "FlareNUMBER_params ParameterName VALUES".
* 4. Save and load the save.
After load save you will see changes, so, with this you don't need to recompile your level to see how your lens flare will looks like.
==Bugs/Limitations==
====Dithering on Vulkan====
Necro Patch added official support for Vulkan. This issue only for NVIDIA GPU.
File: flaresDX95.jpg| frame | DirectX.
File: flaresDXVK.jpg| frame | Vulkan.
----
====Lens flares render behind ====
Not a bug, but this is not what you expect from real life. You can block lens flare with your first person weapon model and it will not fade out. Fixed in Half-Life 2: Inhuman.
File: bms_flare_viewmodel.jpg| thumb | Black Mesa
File: inhuman_flare_viewmodel.jpg| thumb | Half-Life 2: Inhuman
----
====Sun flare incorrect work with ====
Sun flare change position in sky when player move, this affects to what show when it's enabled. If you want to see in your background level sun flare - place player on needed position. If your moves - attach player to it.
File: cPointViewControlFlareBug.gif| frame | Showcase of problem in background level of Black Mesa: Black Ops - Restored
----
====User can disable lens flares and see defect====
In graphics settings user can turn off all flares, keep in mind this to escape situations like in the picture. Add sprites or corresponding skins, paint sun on your skybox if don't plan to use .
File: cXENWHEN.jpg| frame | Option enabled. Dr. Rosenberg hold enabled flashlight, everything looks fine.
File: cXEN2WHEN.jpg| frame | Option disabled. Dr. Rosenberg still hold enabled flashlight, but flashlight looks disabled in fact.
----
====Doesn't work with 3D Skybox====
Don't use in your 3D skyboxes, 3D skybox will not show flares.
----
====Sun flare render through 3D Skybox objects====
Unlike , sun flare renders through any object pasted in 3D Skybox environment. Keep in mind this before you will create 3D Skybox.
File: cFLARESKYBUG1.jpg | frame | Clear example (the missiles is 3D Skybox objects).
----
====Incorrect work with -tools====
If you don't use Full Screen - lens flares will be displayed offset from where they initially should be.
File: Flare_in_tools.jpg| thumb | An example (note that the tram flares is in a wrong place).
== See also ==
* 
* 
* 
* 
* 
* New_Specular
* Lighting
* Adding Light
* Intermediate Lighting
* Advanced Lighting
* env_sprite
* BlackMesa XenEngine: Part2 – How a Frame is Rendered (page from Black Mesa developer about new graphics features)
* BlackMesa XenEngine: Part1 – Heavily Modified Source Engine (page from Black Mesa developer about Black Mesa engine, better known as )