May 20, 201412 yr me, too :wub: ! is there some chance to deactivate cloud shadows casting to cockpit in the clouds and over the clouds ?? i´m trying to prevent that (don´t found any dataref) with shaders, too, but have no luck ! look also forward ! Greetings! AMD Ryzen 9 9950X3D , watercooled, GeForce RTX 4090, RAM 64GB Kingston Fury 6000Mhz , Fractal Design 7 XL, MSI X670 Carbon, all SSD
May 20, 201412 yr on cockpit! , wrong text deleted! AMD Ryzen 9 9950X3D , watercooled, GeForce RTX 4090, RAM 64GB Kingston Fury 6000Mhz , Fractal Design 7 XL, MSI X670 Carbon, all SSD
May 28, 201412 yr Hello all, I just would like to share the lua script I am currently using. I was having a problem with white clouds during the night due to the value of "sim/private/controls/clouds/ambient_gain" being larger than 1.0 (it was set to 4.0 in the script I copied from this forum). So I wrote a small function that smoothly changes this value from 1.0 to 2.5 between 5-7am and back from 2.5 to 1.0 from 6-8pm (local time always). Thus, we get the whiter clouds during the day, and the normal darker clouds during night / sunrise / sunset. I hope someone will find this useful. To use it, simply delete the line below (if you have it) from your lua script: set( "sim/private/controls/clouds/ambient_gain", 4.0) and add the following lines in the end: function white_cloud () dataref ("localTime", "sim/time/local_time_sec", "readonly") if localTime < 18000.0 then -- if earlier than 5am then cloud's ambient_gain set to normal value (1.0) set( "sim/private/controls/clouds/ambient_gain", 1.0) end if (localTime >= 18000.0) and (localTime <= 25200.0) then -- if between 5 and 7am, value changes smoothly from 1.0 to 2.5 y = (localTime - 18000.0) / 7200.0 -- that is, y goes from 0. til 1. from 5 til 7am x = y * 1.5 + 1.0 -- i.e., x goes from 1.0 to 2.5 set( "sim/private/controls/clouds/ambient_gain", x) end if (localTime > 25200.0) and (localTime < 64800.0) then -- if between 7am and 6pm, value set to 4.0 set( "sim/private/controls/clouds/ambient_gain", 4.0) end if (localTime >= 64800.0) and (localTime <= 72000.0) then -- if between 6pm and 8pm, value changes smoothly from 2.5 to 1.0 y = (72000.0 - localTime) / 7200.0 -- that is, y goes from 1. til 0. from 6 til 8pm x = y * 1.5 + 1.0 -- i.e., x goes from 1.0 to 2.5 set( "sim/private/controls/clouds/ambient_gain", x) end if localTime > 72000.0 then -- if later than 7pm then cloud's ambient_gain set back to normal value set( "sim/private/controls/clouds/ambient_gain", 1.0) end end do_often ("white_cloud()") Regards, Gilberto
May 28, 201412 yr Hello Gilberto ! Thank you for sharing this script ! But some small hint from my side -> if you are writing scripts according to daytime -> I always use DataRef "sun_pitch_degrees" in such cases, because this DataRef have "always" the same value (of course according to current sun pitch), summertime- or "location-independent" . (please correct me if this is not "true", but I´m using this for my different scripts) dataref("sun_ptc", "sim/graphics/scenery/sun_pitch_degrees","readonly") At the moment, the sun in the central europe is going down about 20:45 (local time), so if I use your script, it will be to early for "darker clouds" ! As I said, just a small hint ! Cheers! Arnel AMD Ryzen 9 9950X3D , watercooled, GeForce RTX 4090, RAM 64GB Kingston Fury 6000Mhz , Fractal Design 7 XL, MSI X670 Carbon, all SSD
May 28, 201412 yr Hi Arnel, Thank you very much for your reply. You are totally correct about this, thanks for pointing me out for the sun_pitch_degrees dataref. When I wrote that script, I actually realized that it would not work out well in different regions or time periods due to different daytime periods around the world, and I was not aware that such dateref existed. So here is a much better version, if anyone would be interested (I also changed the do_often for do_every_frame, for those who like to fast forward the time using the keys K and L and watch the beautiful light of X-Plane 10 ): dataref ("sunPitch", "sim/graphics/scenery/sun_pitch_degrees", "readonly") function white_cloud () if sunPitch < 0 then set( "sim/private/controls/clouds/ambient_gain", 1.0) end if (sunPitch >= 0) and (sunPitch <= 8.5) then y = sunPitch / 8.5 -- that is, y goes from 0. til 1. according to the sun's angle x = y * 1.5 + 1.0 -- i.e., x goes from 1.0 to 2.5 set( "sim/private/controls/clouds/ambient_gain", x) end if sunPitch > 8.5 then set( "sim/private/controls/clouds/ambient_gain", 2.5) end end do_every_frame ("white_cloud()") Take care! Gilberto
May 28, 201412 yr By the way, does anybody know where could I find a list of all datarefs that are private (sim/private/*)? I found a list with all of them except for the private ones (which is exactly where the art controls live): http://www.usna.edu/Users/cs/taylor/studentResearch/xplane/datarefs.txt Thanks a lot, Gilberto
May 28, 201412 yr you are welcome ! Thanks, your script allready implemented in my FlyWithLua file. Art controls or datarefs are not officially documented -> from Ben Supnik´s blog: "The art controls are mapped into the domain sim/private/controls/…. by X-Plane. Like all sim-private datarefs (sim/private) these datarefs are undocumented and unsupported and may not be there in future builds. Your plugin, panel, or object should not depend on any sim/private datarefs! They should only be used for diagnostics/debugging." Greetings, Arnel ! AMD Ryzen 9 9950X3D , watercooled, GeForce RTX 4090, RAM 64GB Kingston Fury 6000Mhz , Fractal Design 7 XL, MSI X670 Carbon, all SSD
May 29, 201412 yr I am glad to hear you found my script useful, Arnel! Also, thanks for clearing it all up about the art controls. Take care!Gilberto
May 29, 201412 yr Will this work with the latest 10.30b1? ASUS ROG Maximus Hero XII ▪︎ Intel i9-10900K ▪︎ NVIDIA RTX 3090 FE ▪︎ 64GB Corsair Vengeance RGB Pro ▪︎ Windows 10 Pro (21H1) ▪︎ Samsung 970 EVO Pro 1TB NVME SSD (OS Drive) ▪︎ Samsung 860 EVO 2TB SATA SSD ▪︎ Seagate 4TB SATA HDD ▪︎ Corsair RMx 850W PSU
May 29, 201412 yr Hmm, I haven't tested it (I am still using 10.25), but I believe it should work. You can try it for yourself by simply saving that script as something.LUA, then copying it to the Script folder of FlyWithLua. Then just use the K and L keys to control time. If the clouds are very white during the day and relatively dark during night and sunset/sunrise, then it means it is working. You might need to tweak some values though. Here is a modified version which makes tweaking much easier. Simply play with the values of the three variables named ambientGainMax, ambientGainMin and sunPitchMax (they are in the very beginning of the file, already set with my personal values). The first two control the min and max values of the ambient_gain dataref (I use 0.5-2.5, default X-Plane value is 1.0). The last one, sunPitchMax, controls the angle of the sun in the sky when the transition between light->dark clouds will happen. At 0 degrees it is always at its darkest, and then at sunPitchMax degrees the clouds will be at their brightest. -- maximal and minimal values for the ambient_gain and the sun angle that activates the darkening/lightening of the clouds -- feel free to play with these values. My personal settings are ambientGainMax = 2.5, ambientGainMin = 0.5, sunPitchMax = 8.5 ambientGainMax = 2.5 ambientGainMin = 0.5 sunPitchMax = 8.5 -- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * dataref ("sunPitch", "sim/graphics/scenery/sun_pitch_degrees", "readonly") function white_clouds () if sunPitch < 0 then set( "sim/private/controls/clouds/ambient_gain", ambientGainMin) end if (sunPitch >= 0) and (sunPitch <= sunPitchMax) then y = sunPitch / sunPitchMax x = y * (ambientGainMax - ambientGainMin) + ambientGainMin set( "sim/private/controls/clouds/ambient_gain", x) end if sunPitch > sunPitchMax then set( "sim/private/controls/clouds/ambient_gain", ambientGainMax) end end do_every_frame ("white_clouds()") I hope this will help. Take care, Gilberto
May 29, 201412 yr Thanks I will give that a try Gilberto. ASUS ROG Maximus Hero XII ▪︎ Intel i9-10900K ▪︎ NVIDIA RTX 3090 FE ▪︎ 64GB Corsair Vengeance RGB Pro ▪︎ Windows 10 Pro (21H1) ▪︎ Samsung 970 EVO Pro 1TB NVME SSD (OS Drive) ▪︎ Samsung 860 EVO 2TB SATA SSD ▪︎ Seagate 4TB SATA HDD ▪︎ Corsair RMx 850W PSU
May 31, 201412 yr Hi all, Here is yet another little script of mine, this time taking care of the night light. What was bothering me is that as soon as the sun angle is exact 5 degrees, all night lights in the roads, poles, buildings, etc., would be turned on at the same time, as if there was one single switch for the whole town. What my script below does is that it smoothly creates a transition, so the lights in the roads and poles now take 5 minutes to smoothly go from off to on. The overall effect is much better in my opinion. -- maximal values for lights/scale_far and the sun angles (max and min) that activates the transition of lights -- feel free to play with these values. My personal settings are MaxScaleFar = 0.80, MaxScaleNear = 0.50, sunPitchMax_NLT = 5.0 and sunPitchMin_NLT = 4.5 MaxScaleFar = 0.80 MaxScaleNear = 0.50 sunPitchMax_NLT = 5.0 -- the suffix _NLT was added since I use the same variable in another script of mine. I recommend you to NOT change this value since X-Plane always activate the lights when the sun is at exactly 5 degrees above horizon sunPitchMin_NLT = 4.5 -- the angle when the lights will be fully on. This value can be freely modified. -- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * dataref ("sunPitch", "sim/graphics/scenery/sun_pitch_degrees", "readonly") function night_light_transition () if sunPitch < sunPitchMin_NLT then set( "sim/private/controls/lights/scale_far", MaxScaleFar) set( "sim/private/controls/lights/scale_near", MaxScaleNear) end if (sunPitch >= sunPitchMin_NLT) and (sunPitch <= sunPitchMax_NLT) then y = ( sunPitch - sunPitchMin_NLT) / ( sunPitchMax_NLT - sunPitchMin_NLT) x1 = (1 - y) * MaxScaleFar x2 = (1 - y) * MaxScaleNear set( "sim/private/controls/lights/scale_far", x1) set( "sim/private/controls/lights/scale_near", x2) end if sunPitch > sunPitchMax_NLT then set( "sim/private/controls/lights/scale_far", 0.0) set( "sim/private/controls/lights/scale_near", 0.0) end end do_every_frame ("night_light_transition()") Please note that if you already use another script to control the lights and it contains the datarefs lights/scale_far and lights/scale_near, then you will have to delete these lines from it. I hope someone will find this useful. Regards, Gilberto One more thing: I could not do the same for the lights of the buildings, since I could not find the dataref that controls it. The effect is not bad, since they are far less dominant than the street lights, but if someone knows which dataref controls the building's light intensity, I'd be glad to hear about it and then update my scrip!
May 31, 201412 yr And for those who prefer video than code, here is a short demonstration of both of my scripts (night transition and white clouds): https://www.youtube.com/watch?v=Afq_-hpgapI
May 31, 201412 yr Could you share your entire script with all of the settings that you use i.e every setting that was changed? I'm a novice, so would prefer to copy and paste the whole lot if you don't mind please?
Archived
This topic is now archived and is closed to further replies.