www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/04/29/02:17:05

Newsgroups: comp.os.msdos.djgpp
Subject: Re: Real-time lens flares w/ Allegro?
From: root AT delorie DOT com (Demandred)
Organization: Cerberus Software
References: <D1FB30BBA491D1118E6D006097BCAE392DBB06 AT Probe-nt-2a DOT Probe DOT co DOT uk>
MIME-Version: 1.0
NNTP-Posting-Host: remote791.compusmart.ab.ca
Message-ID: <3546829f.0@ntnews.compusmart.ab.ca>
Date: 29 Apr 98 01:30:07 GMT
Lines: 61
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

In article <D1FB30BBA491D1118E6D006097BCAE392DBB06 AT Probe-nt-2a DOT Probe DOT co DOT uk>, 
ShawnH AT Probe DOT co DOT uk was heard to ramble thus:
[snip]
>Lensflare is an additive effect: a black flare value should leave 
>the original color unchanged, while lighter flare colors will 
>increase the brightness of the screen color. To do this in Allegro,
>you will need to make a custom mapping table (using the
>create_color_table() function). In your blender function callback,
>just add the two rgb values, clamping to white if the result 
>overflows.

Additive color.

<smacks forehead>

Thanks =)

(An additive color table would be great for some other funky things... 
especially really cool explosions.  I'm pretty sure I could get an effect 
similar to the Allegro demo's explosions, but generated on the fly.  Then 
there's lightmaps and other funky lighting effects like fake speculars.  Shawn: 
you should put an additive-color-map-generating function into Allegro, or an 
additive draw mode - just to make coding easier for poor lazy plebs like me =)

>If you can't afford the memory for an extra mapping table, you can
>get fairly decent effects using normal interpolating translucency,
>if you draw the flares using very pale colors and not too solid.
>I have to do them this way on the N64 at work (it doesn't support 
>additive color), and it doesn't look too far off as long as you
>use sensible source images.

That might work fairly well, too.

>In terms of making things look nice, the important thing is not to
>overdo it: make the flares quite subtle. Position them at irregular
>intervals along your light vector: tweaking these numbers can make
>a big difference to how smoothly they move as the light source moves
>around the screen. If you can do variable translucency levels (by 
>using a truecolor mode, multiple color mapping tables, or different
>versions of the flare graphics), try fading out the alpha as the
>light source moves towards the edges of the screen.

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?

<off_topic severity=mild>
Any other cool graphics tricks floating around this newsgroup's collective 
brain?
</off_topic>

-- 
Demandred, Lord of the 32-bit Registers
mail to: demandrd 'at' compusmart 'dot' ab 'dot' ca
http://www.nnetis.ca/~matt/dogfight.html
BobCode: 
KOGktpdsh- lW ECsO m2 CPEIc B18 Oul LGM ScjC++++++++++ Tx A6AT H8o b2 D1

- Raw text -


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