Game Development Community

dev|Pro Game Development Curriculum

GuiLensFlareHud - Lens flares and white out for TGEA 1.8.1

by Jaimi McEntire · 05/14/2009 (12:20 pm) · 4 comments

This resource adds functionality for standard lens flares and screen whiteout. When the sun gets closer to the center of the screen, a whiteout effect is also applied. Lensflares or whiteout do not display when the camera is underwater.

To install, download the code file below, and add fxLensFlare.h, fxLensFlare.cpp, and GuiLensFlareHud.cpp to you your project (I put mine in engine/source/T3D/fx)

If you have modified FxSunlight, then you will need to use a program like WinMerge to add the needed changes to fxSunlight.cpp and fxSunlight.h to your version. If you have not made any changes to these, you can simply replace them with the files included in the zip.

Download code

Here is a picture of the lensflare:

www.aztica.com/images/GuiLensFlare.jpg
You will need to have a lensflares.png placed in your game/common/lighting directory. This png file should contain 4 different lensflare styles.

Here is a sample Lensflares.png file:

www.aztica.com/images/LensFlares.png
Currently, the number, size and color of the lensflares are specified in the source. You can modify this as needed. Later versions of this will likely be more dynamic.

To use this, add a GuiLensFlareHud control to your PlayGui. Align it to the play area, and place it at the top of the stack (otherwise, lensflares can draw over gui elements).

GuiLensFlareHud has the following properties:

RenderFlares (bool): Whether or not to render lens flares. Default is true.
WhiteOut (bool): Whether or not to white out the screen. Default is true.
WhiteOutColor (ColorI): The color of the whiteout. Default is a partially transparent white.
WhiteOutFade (float): The time to fade the white out, in seconds. Default is 1 second.




#1
05/14/2009 (1:21 pm)
Thanks Jaimi.
#2
05/14/2009 (8:27 pm)
Cool, thanks!
#3
05/14/2009 (9:06 pm)
definite addition to my game...thanks
#4
05/15/2009 (4:13 pm)
Works like a charm, tyvm.