April 18, 201412 yr Here is a short script that changes the LOD (of the 3D) dynamically depending on aircraft altitude. This helps with FPS on the ground and enhances the experience for higher altitude. I didn't write the lua script - I just cut it down to my needs. The orginal script by MayDayC can be found here (see OP) and involves a lot more: http://forum.aerosoft.com/index.php?/topic/80537-xp10-performance-tweak-fur-besserer-framerate-mit-dataref/ Although it works for me - this is HIGLY EXPERIMENTAL and may cause unknown side effects !!! I just wanted to share the idea and outcome so far. Don't ask me about how it works - because I don't know. I'm just beginning to get my feet wet with this lua stuff. Here's the script anyway: ------------------------------------------------------------------ Performance tweak and dynamic level of detail LOD adjustment script for X-Plane 10-- Date: 15.04.2014-- Version: 0.1-- Author: MaydayC / Germany---------------------------------------------------------------------DataRef( "h_ind", "sim/flightmodel/misc/h_ind") -- Altitude over groundDataRef( "LOD_bias_rat", "sim/private/controls/reno/LOD_bias_rat")DataRef( "air_alt", "sim/cockpit2/gauges/indicators/altitude_ft_pilot","readonly")-- The following parameters are the important parts for a higher framerate !!!!-- 0.0 = deactivate - 1.0 = activate-- fade_start_rate: Fade in objects in distance. Default is 0.5. With 1.0 max. visibility in distance is reachedset( "sim/private/controls/terrain/fade_start_rat", 0.9 ) newlod = 1.2oldlod = newlodlod_factor = 3.0 -- Personal preference. Higher value = lowers the LOD-- Set the initial Level of Detailset( "sim/private/controls/reno/LOD_bias_rat", lod_factor )function round2(num, idp) return tonumber(string.format("%." .. (idp or 0) .. "f", num))endfunction setLOD() -- calculate the level of detail newlod = round2(math.abs(((h_ind) * 0.0010)-lod_factor),2) -- Calculation could be changed. if h_ind > 2500 or newlod < 1.2 then -- Max altitude or higher = full LOD newlod = 1.2 end if newlod < 1.2 then newlod = 1.2 -- Max LOD end if newlod > lod_factor then newlod = lod_factor -- Lowest LOD end if oldlod ~= newlod then -- finaly set the LOD if there is a change since last run set( "sim/private/controls/reno/LOD_bias_rat", newlod ) end oldlod = newlod endfunction showLod() -- if needed display the LOD, -- pos = bubble(20, 20, "Status", "LOD: "..newlod)enddo_every_draw("showLod()")do_often('setLOD()') Greetz Flo Flo B.
April 18, 201412 yr Gave it a quick test. Seems to work for me, too. Nice! Thank you for the heads up.
Create an account or sign in to comment