Hard Light Productions Forums

Modding, Mission Design, and Coding => FS2 Open Coding - The Source Code Project (SCP) => Topic started by: Fry_Day on September 10, 2003, 06:47:03 am

Title: Did someone say "Lens Flare"?
Post by: Fry_Day on September 10, 2003, 06:47:03 am
I have implemented Lens Flares, and committed the code changes required to CVS.
To create lens flares, you modify stars.tbl, for every sun to include, after $SunRGBI:
Code: [Select]

$Flare:
+FlareCount ;number of flares
$FlareTexture1:   ;texture name
$FlareTextureN: ;goes up to 6 different textures
$FlareGlow1: ;up to 10 glows (actual bitmaps on the screen
+FlareTexture: ;texture number, between 0 to N-1 (references to textures defined earlier, just substract 1)
+FlarePos: ;floating point number, 0.0 is on the sun, 1.0 is the point on the opposite side (treat the center of the screen as the point of symmetry)
+FlareScale: ;scale
$FlareGlowN:
...


For example, the flare I use with every sun is:
Code: [Select]

$Flare:
+FlareCount: 10
$FlareTexture1:   Corona1
$FlareTexture2:   Corona2
$FlareTexture3:   Corona3
$FlareTexture4:   Corona4
$FlareGlow1:
+FlareTexture: 0
+FlarePos: 1.0
+FlareScale: 1
$FlareGlow2:
+FlareTexture: 1
+FlarePos: 0.717
+FlareScale: 1
$FlareGlow3:
+FlareTexture: 1
+FlarePos: 0.25
+FlareScale: 1
$FlareGlow4:
+FlareTexture: 0
+FlarePos: 0.611
+FlareScale: 1
$FlareGlow5:
+FlareTexture: 3
+FlarePos: 0.381
+FlareScale: 1
$FlareGlow6:
+FlareTexture: 2
+FlarePos: 1.026
+FlareScale: 1
$FlareGlow7:
+FlareTexture: 3
+FlarePos: 1.056
+FlareScale: 1
$FlareGlow8:
+FlareTexture: 3
+FlarePos: 0.083
+FlareScale: 11
$FlareGlow9:
+FlareTexture: 2
+FlarePos: 0.656
+FlareScale: 1
$FlareGlow10:
+FlareTexture: 2
+FlarePos: 0.549
+FlareScale: 1

I can't attach files, or I'd show you some screen-shots. Even though the glow I put together is totally half-assed with bad textures, it still looks nice.
If the sun is occluded, the glow won't show up, and as long as you don't screw the table entry up, everything should work. I'm pretty sure the limits can go up a lot without losing stability, so give me a shout if you want higher limits.
Title: Did someone say "Lens Flare"?
Post by: vyper on September 10, 2003, 07:10:32 am
Oooh!
I likey the sound of this!:)
Title: Did someone say "Lens Flare"?
Post by: Fineus on September 10, 2003, 07:37:10 am
The people cry:

:hopping: Screenshots! Screenshots! :hopping:
Title: Did someone say "Lens Flare"?
Post by: Flipside on September 10, 2003, 07:45:26 am
If someone can throw up a compiled version of the .EXE I could probs do some? ;)

Flipside :D
Title: Did someone say "Lens Flare"?
Post by: IceFire on September 10, 2003, 08:12:35 am
Excellent!  Should look fantastic!
Title: Did someone say "Lens Flare"?
Post by: Fry_Day on September 10, 2003, 12:00:03 pm
Sorry, but I don't have any web-space, and I can't attach files, so you'll have to wait for someone else :(
Title: Did someone say "Lens Flare"?
Post by: Flipside on September 10, 2003, 12:06:57 pm
LOL

Ok, everyone imagine an Orion, with the sun just above it, specular highlights gleaming almost as bright as the lights, with a lens flare arcing across your screen ;)

Flipside :D
Title: Did someone say "Lens Flare"?
Post by: Lightspeed on September 10, 2003, 12:49:18 pm
yeah, specular should be very bright if youre near a sun :D

extreme contrast :)

And the lense flare would simply give it the final touch to look :yes:
Title: Did someone say "Lens Flare"?
Post by: kasperl on September 10, 2003, 01:11:46 pm
Quote
Originally posted by Fry_Day
Sorry, but I don't have any web-space, and I can't attach files, so you'll have to wait for someone else :(


[email protected]

add HLP in the subject bar.
Title: Did someone say "Lens Flare"?
Post by: redmenace on September 10, 2003, 01:33:06 pm
Fry_Day you need to contact stealth about a swooh account. :D
Title: Did someone say "Lens Flare"?
Post by: kasperl on September 10, 2003, 01:49:44 pm
www.swooh.com/peon/kasperl/flare.jpg

(http://www.swooh.com/peon/kasperl/flare.jpg)

nice
Title: Did someone say "Lens Flare"?
Post by: Fry_Day on September 10, 2003, 01:49:58 pm
Sent. :)

I run x4 AA (I looove my Radeon 9800 Pro AIW :D ), so the text is kind of garbled, and I spent a grand total of 10 minutes on the table entry, so better lens-flare effects shouldn't be hard to craft.
Title: Did someone say "Lens Flare"?
Post by: kasperl on September 10, 2003, 01:51:06 pm
Quote
Originally posted by Fry_Day
Sent. :)

I run x4 AA, so the text is kind of garbled, and I spent a grand total of 10 minutes on the table entry, so better lens-flare effects shouldn't be hard to craft.


i seem to post faster then you, but i like this effect already.
Title: Did someone say "Lens Flare"?
Post by: Fry_Day on September 10, 2003, 01:54:20 pm
Okay, on an off-hand note, I think that thruster glows should be drawn the way sun glows are right now - if you see the thruster, the full glow is drawn without Z-buffering. If you can't see it no glow is drawn. Remember that the glow is simulating a light source so strong that it creates bleeding to adjacent pixels, so if you can't see the light source, there should be no glow.
Title: Did someone say "Lens Flare"?
Post by: Flipside on September 10, 2003, 01:59:37 pm
Sorry, you confused me a bit there, do you mean that you want no glow drawn when the light is obscured, or that you DO want glow to 'bleed' out, even if the source of the light is hidden?

Flipside :D
Title: Did someone say "Lens Flare"?
Post by: Fry_Day on September 10, 2003, 02:06:15 pm
Look at the myrmidon's engine glows. Right now, they intersect and are partially obscured by the hull. The idea is that if you see the point in the middle of the glow, draw it over everything (so it doesn't intersect), because that's the way it's supposed to behave. If you can't see the middle of the glow, don't draw it at all.
FS actually supplies a nice way to check if you can see a point (look at shipfx_point_in_shadow does the check for suns).
Title: Did someone say "Lens Flare"?
Post by: Amon_Re on September 10, 2003, 02:19:42 pm
*drools*

*drools some more*

Cheers
Title: Did someone say "Lens Flare"?
Post by: Flipside on September 10, 2003, 02:26:15 pm
Ah yes, I can see what you mean now, and I agree, it always looks a bit 'odd' having the hull intersect with the glow from the Engine, there is this sort of 'jittery' effect as the lens flare flickers.

Flipside :)
Title: Did someone say "Lens Flare"?
Post by: Lightspeed on September 10, 2003, 05:17:54 pm
those lense flares -- way too colourful :D
Title: Did someone say "Lens Flare"?
Post by: Flipside on September 10, 2003, 05:20:09 pm
That one is, but then, it was only a test to see if it worked. You can define your own lens flare 'Glows' to suit your tastes :)

Flipside :D
Title: Did someone say "Lens Flare"?
Post by: ZylonBane on September 10, 2003, 08:44:39 pm
Eek. It's the Attack of the Computer Graphic Cliches!

Just because you can do something doesn't mean you should. I've always rather liked the fact that V had the willpower to resist throwing in lens flares.
Title: Did someone say "Lens Flare"?
Post by: Bobboau on September 10, 2003, 09:06:15 pm
I sort of agree with ZB, that is I don't like lens flares on princepal, in the game you are not a camera, but rather you are a human in a cocpit, there for you will not have lens flares,

HOWEVER; I do think this is a very good implementation, and it is great to have the option.

as for the thruster glow thingy, I disagree, the point in shadow isn't very good, I see it giveing false positives all the time, and I am sure it'll be slow as hell,

I was thinking it might be a good idea to use this function to have a sort of dynamic shadowing were you test the center of a model and if it is in a shadow you don't light it, big ships would not be affected by this, little ships wouldn't cast shadows, the effect you would have would be the smaller ships getting shadowed by the larger ones, imagen several bomber wings going after a jugernat as ther aproch they enter the shadow of the ship and are only lit by there glow mapping and weapons fire
Title: Did someone say "Lens Flare"?
Post by: IceFire on September 10, 2003, 09:07:03 pm
Quote
Originally posted by ZylonBane
Eek. It's the Attack of the Computer Graphic Cliches!

Just because you can do something doesn't mean you should. I've always rather liked the fact that V had the willpower to resist throwing in lens flares.

Actually they didn't...one version of FS1 did have flares...but apparently it was unstable at the time and only worked on 3DFX.

Lens flares are nice with the suns...but rarely elsewhere.

I cannot see the image...the site must be down.
Title: Did someone say "Lens Flare"?
Post by: StratComm on September 10, 2003, 09:13:53 pm
did you click the link?  It didn't show up for me either until I actually went to the pic.

I do not partucularly like the lens flare effect, but that's a personal taste.  I'd love to see it as a launcher-selectable command line option though (or to eventually have an additional options screen made so that we can set these preferences in a more defined matter) as it is, in principle, a good graphical addition.
Title: Did someone say "Lens Flare"?
Post by: Flipside on September 10, 2003, 09:16:56 pm
Quote
Originally posted by Bobboau
I was thinking it might be a good idea to use this function to have a sort of dynamic shadowing were you test the center of a model and if it is in a shadow you don't light it, big ships would not be affected by this, little ships wouldn't cast shadows, the effect you would have would be the smaller ships getting shadowed by the larger ones, imagen several bomber wings going after a jugernat as ther aproch they enter the shadow of the ship and are only lit by there glow mapping and weapons fire


:nod: :nod: :nod:

MMmmmm....Luvverly EyeCandy, optional, but sweet :D

Flipside :D
Title: Did someone say "Lens Flare"?
Post by: mikhael on September 10, 2003, 09:28:09 pm
Quote
Originally posted by Bobboau
I sort of agree with ZB, that is I don't like lens flares on princepal, in the game you are not a camera, but rather you are a human in a cocpit, there for you will not have lens flares,

HOWEVER; I do think this is a very good implementation, and it is great to have the option.

as for the thruster glow thingy, I disagree, the point in shadow isn't very good, I see it giveing false positives all the time, and I am sure it'll be slow as hell,

I was thinking it might be a good idea to use this function to have a sort of dynamic shadowing were you test the center of a model and if it is in a shadow you don't light it, big ships would not be affected by this, little ships wouldn't cast shadows, the effect you would have would be the smaller ships getting shadowed by the larger ones, imagen several bomber wings going after a jugernat as ther aproch they enter the shadow of the ship and are only lit by there glow mapping and weapons fire


What he said.
Title: Did someone say "Lens Flare"?
Post by: Nico on September 11, 2003, 01:49:39 am
I like eyecandy, therefore I like lenseflares :)
Title: Did someone say "Lens Flare"?
Post by: Black Wolf on September 11, 2003, 03:31:10 am
As an optional addition, this is an excellent modification. Good stuff :yes:
Title: Did someone say "Lens Flare"?
Post by: J.F.K. on September 11, 2003, 09:16:54 am
Quote
Originally posted by kasperl
www.swooh.com/peon/kasperl/flare.jpg
nice


Agreed :yes:
Title: Did someone say "Lens Flare"?
Post by: Carl on September 11, 2003, 10:27:52 am
i think the glows on the engines are physical thrust, not glows, so the should in fact be seeable even when the center is obscured. yes, i know it rotates with you, but i think that's just the rays coming out.
Title: Did someone say "Lens Flare"?
Post by: J3Vr6 on September 11, 2003, 10:31:35 am
Quote
Originally posted by Venom
I like eyecandy, therefore I like lenseflares :)


I gotta agree with Venom.  It looks sweet, and whether you think it's realistic or not I think it gives you more of feeling of being immersed.  You're tailing a shivan fighter and he pulls towards a star.  As you turn to bear, lens flare runs across cockpit bubble causing a brief itch of panic as you fear you've lost the fighter from your sights.  Kind of reminds me of Top Gun, when the MiG pulls up towards the sun to lose Merlin and Maverick.  Makes the game much more involving, I think.

To keep everyone happy, though, maybe it should be an option in the launcher.
Title: Did someone say "Lens Flare"?
Post by: Galemp on September 11, 2003, 11:01:54 am
Cool.

It's a table item, so it's going to be utilized on a per-mod basis. If campaign leaders want lens flares, so be it. Same goes for glowmaps and shine maps--the campaign leaders can support it if they wish.