Skip to content
View in the app

A better way to browse. Learn more.

The AVSIM Community

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

dynamic LOD via art controls LUA SCRIPT

Featured Replies

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 ground
DataRef( "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 reached
set( "sim/private/controls/terrain/fade_start_rat", 0.9 )    


newlod = 1.2
oldlod = newlod
lod_factor = 3.0                                    -- Personal preference. Higher value = lowers the LOD

-- Set the initial Level of Detail
set( "sim/private/controls/reno/LOD_bias_rat", lod_factor )

function round2(num, idp)
  return tonumber(string.format("%." .. (idp or 0) .. "f", num))
end

function 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
    
end

function showLod()
    -- if needed display the LOD,
    -- pos = bubble(20, 20, "Status", "LOD: "..newlod)
end

do_every_draw("showLod()")
do_often('setLOD()')

 

 

 

Greetz

Flo

Flo B.

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

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.