Simulating Lens Flares?
spectecjr asks: "Everyone's seen lens flare effects being used in various 3D games recently (including Half Life, Unreal Tournament, etc); but typically, these effects are simulated using Photoshop to create textures which are then billboarded to the screen. So how do the people who write Photoshop plug-ins simulate lens flares? All the tutorials on the 'net seem to be of the nature of the fake-out method used above. So if you were going to write a lens flare simulation from scratch, how would you do it?" Interesting question. It would be interesting to know the mathematics behind modeling lens flares, using the Photoshop model and more realistic models, if they exist.
this page says that the appearance of the flare depends on the kind of camera that produced it. So if you want to simulate a flare the first question should be "what type of camera am I trying to simulate?"
Take a look at this article on gamedev.net. It might contain what you're after.
Sure simulating fog, heat mirages would make things look more realistic but why are people simulating lens flares? When was the last time you got lens flares in your normal vision?
:).
If you are seeing weird stuff like that in real life maybe you have glaucoma or need to consult an eye doctor ASAP
Gimp has a lens flare simulator in its FlareFX plug-in. Why not get the gimp source and find out how it does it? An option not available for the Photoshop version.
Baz
Any lens flare simulator would have to take into account a lot of factors including, the number of elements in a lenses, often you see lens flare with multiple spots, each one of these spots is caused by a flaring lens elements. Another factor would be the shape of the lens flare which is caused by the apeture diagphram of the lens. If the lens is wide-open (no apeture present) you would get a perfectly round lens flare spot. If it was stopped down to f/8 or so you would get a more hexagon lens flare. I'm not sure about the size of the lens flare with relation to the apeture but I would assume a smaller apeture would yield smaller lens flare spots. So a lens stopped down to f/16 would probably yield a very small lens flare spot as opposed to a wide-open apeture. It's hard to say what a lens flare should really look though like since most photographers go out of there way to avoid them.
Maya (http://www.aliaswavefront.com) for example not only offers lens flares but field of view (so the backgroung and foreground are blury, and only the mid-ground is in focus - or whatever you want).
Alias also has some code to add or remove the distortion from panavision cameras (camera used by movie companies).
As an artist, I have seen entirely too many lens flare effects used in print and other static media. It seems to me that people try to use the addition of a flare to add excitement to an image, but it has become too much.... As far as games and other interactive media are concerned, however, I think that the use of the lens flare could be nice.... Think about driving a car up a hill towards the west in the evening...as you crest the hill, you are temporarily blinded. This could be another interesting use for lens-flare like image manipulations.... I do not have any idea how the math behind the photoshop filter works, but it could be very useful to explore, and possibly create new ways of manipulating the virtual in ways that cannot yet be done in the physical world.... This kind of visual stimulus could really change perceptions! Now thats exciting.
POV-Ray is a great freeware raytracing engine for Win, Mac, and Unix. It makes use of an easy to learn text-format scene description language. There was a set of include files available for POV-Ray that you could use in your scene description to describe the "camera" lenses and thus yield up many teriffic lens flares. I forgot the name of the package, but I think you can still find it in the contrib section. Very impressive!
http://www.povray.org/
USNG: 14TPU4605