lens flare

Is there a tutorial how to create sun lens flare?

Google: blender lens flare

http://wiki.blender.org/index.php/Manual/Halos

:no: blender halos doesn’t work in the bge.
maybe an overlay scene can do the trick :wink:

I guess he refers on how to do do it in the game engine, not on the renderer…

Well I’m not sure where I got it from but this is Doc Holiday’s ‘walk in the park’ demo which has lens flare, and very nice it is to

http://www.weedyworld.co.uk/blender/demo%20walk%20in%20the%20park.blend

that’s cool!

But way too complex…
The “walk in the park” has bad shading, crazy mouse look, really bad controls…
The last two may be in just recent blender versions.

The “bad controls” are German and French standard I think, also the mouselook got weird somewhere along the way, It work fine when I first got it, then the second or third time I used it (New blender version) it was inverted.

Here’s a really simple way to fake flare that I use in my games. Select your camera, press Shift-S and snap “Cursor–>Selection” to get the cursor exactly on the camera’s center. Add an empty and parent it to the camera. Use logic bricks to have the empty track to your sun object. Then add a script on the empty to get its orientation and save it as “GameLogic.FlareOri” or something. In the same script, you should also have a “GameLogic.CameraOri” variable, if you don’t already have this in another script. Now in an empty scene, add a camera and an empty (in the same place). Add several planes textured with different-colored circles/hexagons with Add enabled on those faces. Make these planes in front of and facing the camera, consecutively getting further away. Parent each one to the empty. Now, add a new script, setting this camera and empty to the orientations of their primary-scene counterparts using the variables you made earlier. And that’s it. Go back to the original scene, and have the new scene set as an overlay. You can use a ray sensor to test whether or not the sun is visible, so you don’t have a random flare while inside a building or something. Of course, this could all be done on one scene, without python, but then you would have problems with the planes going through walls and such. I don’t know. Just the way I do it.

@magnum.A blend file please?
Lens flare what am talking about is like the one u see in ratatouille or stalker clear sky.The sun should brighten if you look at it and the lens flare should disapear where there is obstacle in front of it

Thanks Magnus Opus for the info. Your reply was very comprehensive.