Help to undertanding a lua script from P3D V4 SDK

SDK supports Prepar3D’s philosophy of an open development architecture and encourages third parties to bring new innovations with improved add-ons and training content.
Post Reply
Luis Vargas
Posts: 240
Joined: Wed Mar 28, 2012 5:52 am
Location: Rio de Janeiro, Brazil.
Contact:

Help to undertanding a lua script from P3D V4 SDK

Post by Luis Vargas »

I ask for help to understand how the P3D V4 SKD IRSceneryObject script works. I installed the script, the object appeared in the scenario as expected (Eglin AFB - KVPS), I think its working seems to have something to do with the time of day, but I do not know how produce the expected practical effect.

Image
BenBaron
Posts: 80
Joined: Fri Jan 16, 2015 7:51 am

Re: Help to undertanding a lua script from P3D V4 SDK

Post by BenBaron »

Hi Luis,

I don't understand what exactly you are asking for with the "expected practical effect". Yes, in the example

Code: Select all

local secondsPerDay = 60 * 60 * 24

local percentOfDay = varget("E:LOCAL TIME", "Number") / secondsPerDay
gives you the actual simulator time of day in percent and

Code: Select all

local temperatureScale = 1.0

if percentOfDay < 0.5 then
    
    temperatureScale = minimumScale + ((percentOfDay / 0.5) * (maximumScale - minimumScale))
else
    
    temperatureScale = minimumScale + (((1.0 - percentOfDay) / 0.5) * (maximumScale - minimumScale))
end
sets the temperatureScale depending on the time of day.

With

Code: Select all

varset("T:TemperatureScale", "Number", temperatureScale)
the temperatureScale is then written back to modify the material rendering of the object.

Greets, Benny
Luis Vargas
Posts: 240
Joined: Wed Mar 28, 2012 5:52 am
Location: Rio de Janeiro, Brazil.
Contact:

Re: Help to undertanding a lua script from P3D V4 SDK

Post by Luis Vargas »

Hi, Benny. Thanks for your feedback.

I understood the question of temperature and time of day, but how do I see it working into the simulator? I used the time preview to vary the time but I did not notice any modification in material rendering. I saw only the shadows moving as the time going to forward / backward. Maybe the shadows had maked a confusion in my eyes. I will see again this time with double of attention.

Best regards.
User avatar
WarpD
Posts: 1469
Joined: Mon Feb 14, 2011 5:29 am

Re: Help to undertanding a lua script from P3D V4 SDK

Post by WarpD »

Maybe I'm mistaken... but I think you're messing with an object's infrared image.
Ed Wilson
Senior Developer
Mindstar Aviation
Luis Vargas
Posts: 240
Joined: Wed Mar 28, 2012 5:52 am
Location: Rio de Janeiro, Brazil.
Contact:

Re: Help to undertanding a lua script from P3D V4 SDK

Post by Luis Vargas »

Yes, it is about infrared. I am trying to understand how It Works.
JB3DG
Posts: 609
Joined: Mon Jan 09, 2012 6:44 pm

Re: Help to undertanding a lua script from P3D V4 SDK

Post by JB3DG »

You need to be in an IR camera mode to see the difference.
Jonathan Bleeker
Milviz systems dev

Formerly known as Naruto-kun
Luis Vargas
Posts: 240
Joined: Wed Mar 28, 2012 5:52 am
Location: Rio de Janeiro, Brazil.
Contact:

Re: Help to undertanding a lua script from P3D V4 SDK

Post by Luis Vargas »

Thanks, JB3DG. Only working in NVG (Night Vision Google).

First two in NVG BLACK HOT with time offset from 00:00 to 12:00.

Image

Image

Last two in NVG WHITE HOT with time offset from 00:00 to 12:00.

Image

Image
Luis Vargas
Posts: 240
Joined: Wed Mar 28, 2012 5:52 am
Location: Rio de Janeiro, Brazil.
Contact:

Re: Help to undertanding a lua script from P3D V4 SDK

Post by Luis Vargas »

As shown in the screenshots above at 12 o'clock the texture modified by the script for the object under study differs (from light to dark) from the others objects in scenery. At 00:00 o'clock the textures light or dark are equal for all objects.
Post Reply