Contrary to the lensflare based on the rendering on the screen in post process, the lensflare billboard is rendered in the world on a simple plane, that allows to have more control on the rendering of this one, and to use several different flare, but has a more important blow to a significant number of instance.
The lensflare billboard is intended to be used on local sources such as high power lamps or the sun.
Entirely coded in Shader Material with 80% in HLSL (custom node), and is therefore only on the GPU side, it allows to be very powerful.
Feature :
Billboard Shader WPO : Allows to perform an automatic rotation that faces the camera
Distance to Camera WPO : Allows to put the billboard in front of the camera
Fade Occlusion : As the billboard passes in front of everything and can be in disabled depth test, there is an occlusion test to progressively hide the flare when it is more visible, the number of tests can be configured to be more precise, and the distance of the points is based on the uv of the screen.
Flare : Central Flare which is based on a texture .
Center HighLight : Allows to add a strong Fake light ( Only high value, no light simulation ) in the center of the lensflare, the goal is to play with the rendering of the post process and for example to force the rendering of the bloom on the lensflare.
Ghost : Render reflections on the lens, fully parametric and use a texture to render the reflections. The number is unlimited and with the advanced ghost, it is possible to use texture to render the different color of the reflection.
Lens Relfection : Renders a reflection and difraction effect on the front lens, with a chromatic distortion effect.
LighShaft : Render a local light shaft effect.
2023-05-02 Update v1.1
- FixBug : Correction of occlusion tests
- NEW : Ghost Screen Colorize : Possibility to colorize ghosts according to their position on the screen.
- NEW : Parametric Ghost : New ghost totally parametric one by one, with a posibility of 8 max.
- NEW : Flare Power By ScreenPosition : Additional option to the flare that allows to increase its intensity when it is in the center of the screen.
- NEW : Flare Diffuse : Addition of a new simple flare of diffused light to the flare by texture.
- NEW : Actor : Move Billboard to sun ( Directional Light )
- NEW : Actor : Occlusion by Sphere trace.
Performance : ( Flare Texture 2048 RGBA 16f , Ghost Texture 512 RGBA 16f , AdvancedGhost NoiseTexture 1600 Bad , AdvancedGhost Tint Texture 256x16 Bad LUT texture )
Simple Occlusion + Flare : 0.08ms
FadeOcclusion(4*8) + Flare : 0.31ms
FadeOcclusion(4*8) + Flare + HighLight : 0.33ms
FadeOcclusion(4*8) + Flare + HighLight + Simple Ghost ( 20 ) : 0.52ms
FadeOcclusion(4*8) + Flare + HighLight + Advanced Ghost ( 20 ) : 0.93ms
FadeOcclusion(4*8) + Flare + HighLight + Advanced Ghost ( 20 ) + LensReflect : 1.08ms
FadeOcclusion(4*8) + Flare + HighLight + Advanced Ghost ( 20 ) + LensReflect + LightShaft ( 8 samples ) : 1.33ms
FadeOcclusion(4*8) + Flare + HighLight + Advanced Ghost ( 20 ) + LensReflect + LightShaft ( 32 samples ) : 1.91ms
The performance can be largely impacted by the configuration of the used texture, it is necessary to pay attention to use the mipmap and the good compression ( Effect ).
The number of samples for the light shaft can also have an impact on the performance, it is advised not to exceed 16 samples in the case of a video game, but you can increase strongly in the case of a cinematic rendering.
Recommended texture size :
Base Flare : 2048x2048 RBGA 16f ( HDR Compressed ,Texture goup Effect )
Ghost : 512x512 RBGA 16f ( HDR Compressed, Texture group Effect )
The lensflare is entirely coded in shader material ( GPU Side ), so you can use it with a plane by activating the Billboard material, or with a particle or niagara system, or with a Billboard Material Component.
According to what you will use you will not have the same possibility of rendering, here is a list of limitations.
Billboard Material Component
Allows to render everything correctly, it's probably the best solution, there are still some accuracy concerns at long distance, but less than the Plane version with the billboard shader.
Plane ( StaticMesh Component )
Allows you to render everything, but has some precision problems in its rotation at long distance.
Particle/Niagara
Does not allow to be rendered outside the screen
The billboard was designed to face the camera at a very close distance.
There are 2 materials, one with depth test disabled, and one with depth test enabled.
Base Material Depth test disabled:
Allows to do the complete lensflare with the use of the occlusion test in shader
Base Material Depth test enabled :
Allows to make a basic lensflare without scale and which is not in front of the camera, it is not possible to use the full options.
The automatic rotation in WPO can be done by the shader itself in the case of the use of the plane with the activation of the option "ActiveBillboard", but it can appear worries of precision at long distance.
To have more precision you can use Billboard material by disabling the "ActiveBillboard" in the constant instance material, or use billboard in the particle system.
It is possible to continue to render the effect outside the screen to have the rendering of all the effects, this option is available only for the rendering of a Quad (simple plane) or on the Material Billboard Component.
There are several limitations ;
The depth test will not work correctly because the depth buffer at the flare location is no longer rendered
The lightshaft will lack information to work at maximum
The occlusion test will not work anymore, it is possible that the lensflare is in occlusion and reappears when it goes off screen
The technique consists in increasing the bound scale in the rendering settings, which allows not to pass the lensflare in the frustrum culling.
( Static mesh component or Billboard Material Component )