Special Aircraft Service

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1] 2   Go Down

Author Topic: WxTech's Lightning  (Read 4062 times)

0 Members and 1 Guest are viewing this topic.

WxTech

  • Modder
  • member
  • Offline Offline
  • Posts: 5701
WxTech's Lightning
« on: September 02, 2020, 11:49:38 AM »

UPDATE, Sep 6, 2020: New version for download. Improved further, with all-new addition of code to smoothly vary illumination by Sun angular elevation during transition from day through night! Overall more realistic.

The following 3-panel image shows the transition from day to twilight to night. In each successive frame the viewpoint has been pulled farther back, in order to show the increasing coverage of ground lighting as darkness proceeds. This makes the central bright spot at the strike location appear to not increase in brightness the way it actually does due to attenuation by the fog effect. In all instances the cloud base is at 1000m.



From the Readme.txt file included:


This mod improves the lightning effect seen during "Thunder" type weather.

It should be compatible with all game versions--I think.  ;)

It's important that the Body.msh I supply here, wherein the size has been doubled, is used with this mod.

=============================================================

Several elements go into the total effect, all lasting 0.5 second. In the stock implementation:

- A lightning bolt is drawn, extending from the surface (but not quite so for 2 variants) up to the set height of the cumulus cloud base.
- The lightning bolt is randomly selected from 5 variations in the mesh.
- The interval between flash events is randomly 4 to 8 seconds.
- A light surce is placed 100m below the ground, and is used to light the landscape tiles ONLY. (If this light source is placed above ground, no landscape tile illumination occurs.)
- A light source is placed above ground, 1/3 the way from the surface to the cloud base. This lights up ground objects and 3-D trees (not the layered forests), and the cloud above.
- A sort of 'blast'-like circular texture is placed on the ground, brightest in the center, and is controlled in part at least by the above-ground light source.

=============================================================

The changes:

- Increased the overall size of the lightning bolt mesh, from 1000m to 2000m tall, but retained the same bolt width. Gives a sharper line.
- Fixed the two bolt variations that formerly didn't quite reach the surface.
- Altered the bolt scaling so that they now extend to 1000m higher than the cloud base. Looks much better to see bolts fading up into the clouds, instead of suddenly stopping at their top ends at the cloud base.
- Moved the underground light source from -100m to -500m, decreased its intensity and increased its range. This makes for a subtler ground lighting that extends (at night) to several km.
- Moved the formerly above-ground light source (which varied as 0.3 times the cloud base height) to always 50m below the surface. Also decreased the intensity, but retained the same range. This reduces the brilliance of object and (to a lesser extent) the cloud brightness.
- Altered the illumination from pure white to pinkish.
- Changed the event interval from 4-8s to 1-5s.
- Added all-new code to take into account the altitude of the Sun, so as to smoothly control the illumination during the twilight period (Sun altitude between +6 and -17 degrees). In the daytime the cloud lighting is noticeably weaker, and the ground lighting very much so. During the darkening of twilight, illumination intensity increases. More realistic!

=============================================================

I include the original Body.msh, as well as my Java code in Zip.java (with many comments for ease of interpretation.)


As always with my mods, this work is offered for use or alteration by anyone for any purpose, without restriction.


WxTech
Sep 6, 2020


Get it here

https://www.mediafire.com/file/u2sk302hli9mo8z/file
Logged
Great minds discuss ideas. Average minds discuss events. Small minds discuss people. - Hyman Rickover (but probably predating his use.)

SAS~Bombsaway

  • Choose your battles wisely.
  • SAS Team
  • member
  • Offline Offline
  • Posts: 9213
  • A day without laughter is a day wasted
Re: WxTech's Lightning
« Reply #1 on: September 02, 2020, 12:00:00 PM »

Looks cool. I'll give it a try.
Logged
Do not go gentle into that good night,
Old age should burn and rave at close of day;
Rage, rage against the dying of the light.

SAS~Ghost129er

  • SAS Team
  • member
  • Online Online
  • Posts: 2098
  • SAS Certified Lurk
Re: WxTech's Lightning
« Reply #2 on: September 02, 2020, 01:00:58 PM »

sHoCkInG!
Logged
Current activity: Giving his E46 330ci some TLC.

David Prosser

  • member
  • Offline Offline
  • Posts: 3795
Re: WxTech's Lightning
« Reply #3 on: September 02, 2020, 03:54:30 PM »

What he said.  Well done dude.

EDIT:  Which folder does it go in?



cheers


David

WxTech

  • Modder
  • member
  • Offline Offline
  • Posts: 5701
Re: WxTech's Lightning
« Reply #4 on: September 02, 2020, 04:25:58 PM »

David,
This goes into whatever is your MODS folder. In modact games it's named #SAS. Other flavours might use MODS. And I guess there are others...
Logged
Great minds discuss ideas. Average minds discuss events. Small minds discuss people. - Hyman Rickover (but probably predating his use.)

WxTech

  • Modder
  • member
  • Offline Offline
  • Posts: 5701
Re: WxTech's Lightning
« Reply #5 on: September 03, 2020, 01:36:09 AM »

So I kept on plugging at trying to reduce the ground lighting brightness in the daytime. While I could still find no way to directly adjust the texture that is drawn on the ground, I did succeed in getting a good ways nearer to the desired goal.

For one thing, I placed the light source for the cloud and environment a short distance UNDER the ground. It still does its thing, albeit from a lower perspective. But it now does not add nearly so much to ground brightening. I fiddled with the base nighttime brightness parameters for this and the other light source. Then I added some code to make the brightness parameters vary as the angular height of the Sun. At night these values are at maximum, and in the day at minimum.  In between these extremes, for the range of Sun angular altitude 0.1 to -0.3 (about +6 to -17 degrees), the brightness is linearly scaled, getting brighter with increasing darkness.

The result for daytime is somewhat reduced cloud brightness , and VERY much reduced ground brightness. Yay!

At night the ground illumination is far more gradual, and extends faintly for a few kilometers.

Much better! I'll soon upload this improved version...
Logged
Great minds discuss ideas. Average minds discuss events. Small minds discuss people. - Hyman Rickover (but probably predating his use.)

David Prosser

  • member
  • Offline Offline
  • Posts: 3795
Re: WxTech's Lightning
« Reply #6 on: September 04, 2020, 12:12:56 AM »

OK, thanks, I know where to put it now.

urmel

  • member
  • Offline Offline
  • Posts: 783
Re: WxTech's Lightning
« Reply #7 on: September 04, 2020, 01:04:37 AM »

It looks very good, many thanks for sharing.
Logged

WxTech

  • Modder
  • member
  • Offline Offline
  • Posts: 5701
Re: WxTech's Lightning
« Reply #8 on: September 06, 2020, 09:58:52 PM »

Update: Improved version ready for download, link in first post.
Logged
Great minds discuss ideas. Average minds discuss events. Small minds discuss people. - Hyman Rickover (but probably predating his use.)

Mick

  • Modder
  • member
  • Online Online
  • Posts: 5331
Re: WxTech's Lightning
« Reply #9 on: September 07, 2020, 12:37:07 AM »

... many THX for sharing, WxTech, I don't usually fly when there is thunder & lightning, but shit happens ...!  8)
Logged

WxTech

  • Modder
  • member
  • Offline Offline
  • Posts: 5701
Re: WxTech's Lightning
« Reply #10 on: September 07, 2020, 02:40:00 AM »

Mick,
In conjunction with my changes to Wind.class, flying in Thunder weather is not the hell the stock game made it out to be. I got rid of the useless gust aspect altogether, and made turbulence a saner affair. Now one can actually fly and take in the scenery, without being on the verge of a plane break-up at every moment! That old treatment was just plain annoying, beyond what I'd call an enjoyable challenge.
Logged
Great minds discuss ideas. Average minds discuss events. Small minds discuss people. - Hyman Rickover (but probably predating his use.)

Hans-Joachim Marseille

  • member
  • Offline Offline
  • Posts: 540
Re: WxTech's Lightning
« Reply #11 on: March 23, 2021, 08:29:38 AM »

Nice!  Is this part of BAT yet or still sth. to add yourself!?  :)
Logged
"United we stand against Evil." #FCKPTN. #SlavaUkraini
Pages: [1] 2   Go Up
 

Page created in 0.07 seconds with 27 queries.