delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/04/29/06:09:43

Message-ID: <D1FB30BBA491D1118E6D006097BCAE392EFFB4@Probe-nt-2a.Probe.co.uk>
From: Shawn Hargreaves <ShawnH AT Probe DOT co DOT uk>
To: djgpp AT delorie DOT com
Subject: Re: Real-time lens flares w/ Allegro?
Date: Wed, 29 Apr 1998 11:07:18 +0100
MIME-Version: 1.0

root AT delorie DOT com (Demandred) writes:

Really? That seems rather an unlikely email address :-)

> Instead of putting lens flares along a light vector (which would look 
> supremely cool - hehe) I was actually thinking of blitting a single 
> flare centered over the light source.  Actually, I hadn't heard of the 
> term 'light vector' until you mentioned it - I'm assuming (from the 
> lens flare filters in my graphics package) that it's just a vector 
> from the light source that passes through the center of the screen?

Exactly. Each flare should be positioned some fixed percentage of the
distance along this vector. For a light source at position lx, ly, the
flare should be located at:

    x = lx*n + SCREEN_W/2*(1-n)
    y = ly*n + SCREEN_H/2*(1-n)

If you draw four or five flares at different sizes and with various 
values of n (use odd fractions, including some negative values 
and/or greater than one), you can get some really nice effects as the
flares move around to follow the lightsource.

For the light itself, I would be inclined to use some other sort of
graphic than the regular lensflares, but this is a matter of artistic
preference. Another cool trick with sun-type lights is to flash the
entire screen to white (palette fade) when the light is very close to 
the centre of the display.

	Shawn Hargreaves.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019