Yesterday at 12:24 AM1 day Hi everyone.Goal, create a script that can change visibility for low visibility practice.I created a script, for the pilots that I interface with, included below, that can cycle through multiple visibility values.The problem I am having is that the Sun keeps showing during before Sunset...It can only be used at night with no moon.Tested in default 1244 no addons.I was able to work around that in some prior versions and XP11, but I cannot find a good procedure to get it to work in XP12.I've tried all the Data refs that I could find and none of them were able to mask the Sun, see pic.If any one has a better way to accomplish this, please let me know.I am unable to post a pic, but you can test it in Wx>Manual>Visibity 0.5 SM and go to above 3K Ft during Sunset.Thank you.--ChangeVizUseTV.lua file starts here. Nrs. 1720,450,90 Standard day S.L. Ver0311248--Note: This Function is also now included in "ViewData_sf24IDdispyLODVIS.lua"--Use when Sun and Moon is NOT in view, see through XP12 problem.--Settings / change to low Visibility can take a while, see your settings in--Flight configuration>Wx>Cutomize>Visibility--Use at night, when Sun out of view / horizont is not visible--Assign a Key or button in Settings>LUA>Views>Key to Cycle viz.--Set for 4K resolution--local visibilities = {100, 1609, 16100, 40234, 160934} --in meters (328ft,1sm,10sm,25sm,100sm) can change seq. and add as many as neededlocal visibilities = {0.5, 1, 5, 10, 25, 100}local nextVisibility = 1local tv_xPosOfviz = 120 --Location where X axis "Vis." word is displayed change if not in viewlocal tv_yPosOfviz = 710 --Location where Y axis vis value is displayed change if not in viewlocal tv_xPosOfviz1 = 230 --Location where X axis vis value is displayed change if not in viewset("sim/weather/region/visibility_reported_sm", 35) --to start set("sim/private/controls/stars/gain_photometric", 0.0) --kill stars 16000 is bright --set("sim/private/controls/lighting/E_sun_lx", 0)--add kill Sun not possible? function cycleVisibility() set("sim/weather/region/visibility_reported_sm", (visibilities[nextVisibility])) if nextVisibility < #visibilities then nextVisibility = nextVisibility + 1 else nextVisibility = 1 end endcreate_command("FlyWithLua/Views/CycleViz", "Key to Cycle viz", "cycleVisibility()", "", "")--You can disable this code if you do not ewant / need to view your Vis / Distance--From heredataref("Distance", "sim/weather/region/visibility_reported_sm", "readonly")function displaytviz() --Displays Viz set in SM --draw_string_Times_Roman_24(tv_xPosOfviz, tv_yPosOfviz, nextVisibility-1, "white" ) --tv_TrimAbbr, visibilities={}Distance = string.format("%03.2f", Distance) --added --draw_string_Times_Roman_24(tv_xPosOfviz, tv_yPosOfviz, "Vis.-SM", "white" ) draw_string_Times_Roman_24(tv_xPosOfviz1, tv_yPosOfviz, Distance, "white" )enddo_every_draw ("displaytviz()")--To here
14 hours ago14 hr You can set datarefs all day, but without some cloud layers to block out the sun, fog from an inversion layer is all you will get.Do it the proper way and simply set the weather instead because it's a much more organic, flexible and non-hacky solution. Edited 14 hours ago14 hr by Bjoern 7950X3D + 7900 XT + 64 GB + Linux | 4800H + RTX2060 + 32 GB + Linux My add-ons from my FS9/FSX days
11 hours ago11 hr Author 2 hours ago, Bjoern said:You can set datarefs all day, but without some cloud layers to block out the sun, fog from an inversion layer is all you will get.Do it the proper way and simply set the weather instead because it's a much more organic, flexible and non-hacky solution.Hi Bjoern.Thank you for the response.I do a have a layer of clouds, but is at 30K / Cirrus few.While you are correct that is what XP does, my hope was that someone has found a way around it it, the real life is completely different.I've been real life flying for over 50 years, and instructing for many years and I can tell you that you can be in the soup, no clouds, and break out at 4-5K to a totally clear sky around the coast. Many times pilots log .1 hr of IFR/ IMC in these conditions.There is also a problem with windshield / window reflections in low light / before sunset... and I have a solution for that. I just created clear windows, if any one is interested let me know.I pointed that out to LR before but they seem to think that reflections are more important.I appreciate your input but I am trying to simulate conditions that my group is having to contend with / fly in.It can be very disorienting when you break out in totally clear Wx.
9 hours ago9 hr Author Hi everyone.As an additional statement, at the other end of the spectrum, there are days where there is visibility over 100SM. I've flown in days where coming from Big bear (L35) you could clearly see the buildings at Catalina (AVX), you get the feeling that you could reach out and touch them.We should be able to simulate all those environments.I included below a few DataRefs that users may want to try and see if they can improve their experience, try different values, make small changes, and change one thing at the time, just put all them in a .lua file and place the file in:Drive\:..\X-Plane12\Resources\plugins\FlyWithLua\Scripts--Copy From here:--ClearVis.luaset("sim/private/controls/scattering/override_turbidity_t",1.0) set("sim/private/controls/scattering/single_rat",0.1) set("sim/private/controls/scattering/multi_rat",0.2) set("sim/private/controls/hdr/bloom1",-8.9) set("sim/private/controls/hdr/bloom_exponent",3.12)--To hereWhen I fly VFR, I only fly during Sunset time, 1:23Z Feb, 6, to keep that time where I want I use a script TimeStayMacro:--Copy From here--TimeStay.lua--[[--Move Local Time back, TimeStay within the same minute.--Use if you only like to fly at certain times, like Sunset..--Install the latest version of Lua--Copy the content of this file / text into any FileName.lua--Place that file into X:..\X-Plane 11\Resources\plugins\FlyWithLua\Scripts--To use: In XPlane 11 just start XPlane after you completed the above steps. The script will be automatically loaded.--The most accurate version is the local start_time = os.clock()--Accurate 1sec/ 10min set_back = larger goes forward, increases / later time.--Move Local Time back, TimeStay within the same minute.--Use if you only like to fly at certain times, like Sunset..--Note: It may be system dependent change set_back= value if needed.--You can enable and disable the code via the FWL macro menu in XPlane>Developer...--]]local zulu_t = dataref_table("sim/time/zulu_time_sec")local start_time = zulu_t[0]local set_back = 30 --60TimeStay = falsefunction stay_time()if (TimeStay) thenif (zulu_t[0] > start_time + set_back) thenzulu_t[0] = start_timeendelsestart_time = zulu_t[0]endend--do_often("stay_time()")do_every_frame("stay_time()")add_macro("TimeStay", "TimeStay = true", "TimeStay = false", "deactivate")--To hereWhen I test I never use any Art scrips....I have other Data scripts that show, Location, time, heading, VSI that are more extensive / longer and I do not want to take too much bandwidth.
5 hours ago5 hr 3 hours ago, Avcomware said:As an additional statement, at the other end of the spectrum, there are days where there is visibility over 100SM. I've flown in days where coming from Big bear (L35) you could clearly see the buildings at Catalina (AVX), you get the feeling that you could reach out and touch them.We should be able to simulate all those environments.Download My AutoHaze addon to get almost zero visibility up to 100SM you mention. As a bonus my addon also sets visibility depending on the amount of rain hitting your aircraft. For example, on final to land if you enter a heavy shower the runway that was visible may very well disappear in the rain.AutoHaze replaces X-Plane's static default turbidity with values derived from real atmospheric data sources:CAMS (Copernicus Atmosphere Monitoring Service) — satellite-measured aerosol optical depth at your exact position, updated hourly. This captures genuine regional variation: California with AOD 0.05 looks very different from London with AOD 0.20, which looks very different from Patna with AOD 0.75.VisualCrossing and OpenWeatherMap — real surface visibility, humidity, temperature, dew point and wind at your position, used to fine-tune the turbidity and correct for near-surface conditions.Open-Meteo boundary layer height — the real atmospheric boundary layer height is used to scale turbidity with altitude, so haze reduces naturally as you climb out of the surface layer into clean air above. Edited 5 hours ago5 hr by MrBitstFlyer CPU Ryzen 7800X 3D RAM 32GB Corsair VENGEANCE DDR5 6000MHz GPU GEFORCE RTX 4090 Monitor AOC AGON AG352UCG UltraWide G-Sync @ 3440x1440 Internal Storage 1TB NVMe PCIe SSD External Storage Three 4Tb HDs
4 hours ago4 hr Author 1 hour ago, MrBitstFlyer said:>>get almost zero visibility up to 100SM you mention. As a bonus my addon also sets visibility depending on the amount of rain hitting your aircraft. For example, on final to land if you enter a heavy shower the runway that was visible may very well disappear in the rain.AutoHaze replaces X-Plane's static default turbidity with values derived from real atmospheric data sources:<<Hi. OK, thank you. Do you know what combination of DataRefs you use to get there?Or was there more than just DataRefs value change?
Create an account or sign in to comment