P3Dv4 Material Scripting

Christian Bahr

Resource contributor
but on that topic, has anybody managed to get A2A's free windshield effect working for their own aircraft?
Originally, I once had the hope that you may also get raindrops on glass panes of the tower and buildings. Nothing has come of it. The offer of A2A I had also noticed, but have not done anything in this direction. It is another possibility.
 
Originally, I once had the hope that you may also get raindrops on glass panes of the tower and buildings. Nothing has come of it. The offer of A2A I had also noticed, but have not done anything in this direction. It is another possibility.
Could someone managed to inject render-to-texture to MDL objects?
 

Christian Bahr

Resource contributor
Could someone managed to inject render-to-texture to MDL objects?
Nope, I do not know what it means, have not read or heard anything about it. Do you mean a filter that lies in front of the camera, such as IR filters, night vision filter, etc ...?
 

Christian Bahr

Resource contributor
Hi!

I'm not sure, the link leads to the Lockheed Martin Support Forum. I am also not sure if the article is about the Windshild effect. There is talk of entries in the Panel.cfg related to the entry "texture00=CursorTexture".
This is also something of "ObjectWorldTransform". I do not quite look over there :scratchch
 

Christian Bahr

Resource contributor
Thanks, now I understand it. The article is about animated textures intended to depict raindrops. Unfortunately, that's not what I'm looking for. I'm looking for the reguar windshild effect. As it is installed in many aircraft. Nevertheless, I will look at this later again. At the moment we are in the process of reinventing LUA material scripting.
 
Hi!

Looks like the limitation of LUA scripts to simobjects hasn't been discussed here before, correct?
When I try to add Christian's LUA script sample to a MDL with a XML placement I'm not getting any material changes at all when it's raining and on P3D shutdown (error logging in P3D activated) I'm getting the following log:

[error.0]
error=Failed to execute material script "test.lua": Attempted to access SimObject based variable on a non-SimObject.

[error.1]
error=Failed to execute material script "test.lua": Attempted to access SimObject based variable on a non-SimObject.

[error.2]
error=Failed to execute material script "test.lua": Attempted to access SimObject based variable on a non-SimObject.

[error.3]
error=Failed to execute material script "test.lua": Attempted to access SimObject based variable on a non-SimObject.

[error.4]
error=Failed to execute material script "test.lua": Attempted to access SimObject based variable on a non-SimObject.

[error.5]
error=Failed to execute material script "test.lua": Attempted to access SimObject based variable on a non-SimObject.

[error.6]
error=Failed to execute material script "test.lua": Attempted to access SimObject based variable on a non-SimObject.

[error.7]
error=Failed to execute material script "test.lua": Attempted to access SimObject based variable on a non-SimObject.

[error.8]
error=Failed to execute material script "test.lua": Attempted to access SimObject based variable on a non-SimObject.

[error.9]
error=Failed to execute material script "test.lua": Attempted to access SimObject based variable on a non-SimObject.

[error.10]
error=Failed to execute material script "test.lua": Attempted to access SimObject based variable on a non-SimObject.

[error.11]
error=Failed to execute material script "test.lua": Attempted to access SimObject based variable on a non-SimObject.

[error.12]
error=Failed to execute material script "test.lua": Attempted to access SimObject based variable on a non-SimObject.

[error.13]
error=Failed to execute material script "test.lua": Attempted to access SimObject based variable on a non-SimObject.

[error.14]
error=Failed to execute material script "test.lua": Attempted to access SimObject based variable on a non-SimObject.

[error.15]
error=Failed to execute material script "test.lua": Attempted to access SimObject based variable on a non-SimObject.

[error.16]
error=Failed to execute material script "test.lua": Attempted to access SimObject based variable on a non-SimObject.

[error.17]
error=Failed to execute material script "test.lua": Attempted to access SimObject based variable on a non-SimObject.

[error.18]
error=Failed to execute material script "test.lua": Attempted to access SimObject based variable on a non-SimObject.

[error.19]
error=Failed to execute material script "test.lua": Attempted to access SimObject based variable on a non-SimObject.

[error.20]
error=Failed to execute material script "test.lua": Attempted to access SimObject based variable on a non-SimObject.

[error.21]
error=Failed to execute material script "test.lua": Attempted to access SimObject based variable on a non-SimObject.

[error.22]
error=Failed to execute material script "test.lua": Attempted to access SimObject based variable on a non-SimObject.

[error.23]
error=Failed to execute material script "test.lua": Attempted to access SimObject based variable on a non-SimObject.

[error.24]
error=Failed to execute material script "test.lua": Attempted to access SimObject based variable on a non-SimObject.

[error.25]
error=Failed to execute material script "test.lua": Attempted to access SimObject based variable on a non-SimObject.

[error.26]
error=Failed to execute material script "test.lua": Attempted to access SimObject based variable on a non-SimObject.

[error.27]
error=Failed to execute material script "test.lua": Attempted to access SimObject based variable on a non-SimObject.

[error.28]
error=Failed to execute material script "test.lua": Attempted to access SimObject based variable on a non-SimObject.

[error.29]
error=Failed to execute material script "test.lua": Attempted to access SimObject based variable on a non-SimObject.

[error.30]
error=Failed to execute material script "test.lua": Attempted to access SimObject based variable on a non-SimObject.

[error.31]
error=Failed to execute material script "test.lua": Attempted to access SimObject based variable on a non-SimObject.

[error.32]
error=Failed to execute material script "test.lua": Attempted to access SimObject based variable on a non-SimObject.

[error.33]
error=Failed to execute material script "test.lua": Attempted to access SimObject based variable on a non-SimObject.

[error.34]
error=Failed to execute material script "test.lua": Attempted to access SimObject based variable on a non-SimObject.

[error.35]
error=Failed to execute material script "test.lua": Attempted to access SimObject based variable on a non-SimObject.

[error.36]
error=Failed to execute material script "test.lua": Attempted to access SimObject based variable on a non-SimObject.

[error.37]
error=Failed to execute material script "test.lua": Attempted to access SimObject based variable on a non-SimObject.

[error.38]
error=Failed to execute material script "test.lua": Attempted to access SimObject based variable on a non-SimObject.

[error.39]
error=Failed to execute material script "test.lua": Attempted to access SimObject based variable on a non-SimObject.

[error.40]
error=Failed to execute material script "test.lua": Attempted to access SimObject based variable on a non-SimObject.

[error.41]
error=Failed to execute material script "test.lua": Attempted to access SimObject based variable on a non-SimObject.

[error.42]
error=Failed to execute material script "test.lua": Attempted to access SimObject based variable on a non-SimObject.

[error.43]
error=Failed to execute material script "test.lua": Attempted to access SimObject based variable on a non-SimObject.

[error.44]
error=Failed to execute material script "test.lua": Attempted to access SimObject based variable on a non-SimObject.

[error.45]
error=Failed to execute material script "test.lua": Attempted to access SimObject based variable on a non-SimObject.

[error.46]
error=Failed to execute material script "test.lua": Attempted to access SimObject based variable on a non-SimObject.

[error.47]
error=Failed to execute material script "test.lua": Attempted to access SimObject based variable on a non-SimObject.

[error.48]
error=Failed to execute material script "test.lua": Attempted to access SimObject based variable on a non-SimObject.

[error.49]
error=Failed to execute material script "test.lua": Attempted to access SimObject based variable on a non-SimObject.

[error.50]
error=Failed to execute material script "test.lua": Attempted to access SimObject based variable on a non-SimObject.

[error.51]
error=Failed to execute material script "test.lua": Attempted to access SimObject based variable on a non-SimObject.

[error.52]
error=Failed to execute material script "test.lua": Attempted to access SimObject based variable on a non-SimObject.

[error.53]
error=Failed to execute material script "test.lua": Attempted to access SimObject based variable on a non-SimObject.

[error.54]
error=Failed to execute material script "test.lua": Attempted to access SimObject based variable on a non-SimObject.

[error.55]
error=Failed to execute material script "test.lua": Attempted to access SimObject based variable on a non-SimObject.

[error.56]
error=Failed to execute material script "test.lua": Attempted to access SimObject based variable on a non-SimObject.

[error.57]
error=Failed to execute material script "test.lua": Attempted to access SimObject based variable on a non-SimObject.

[error.58]
error=Failed to execute material script "test.lua": Attempted to access SimObject based variable on a non-SimObject.

[error.59]
error=Failed to execute material script "test.lua": Attempted to access SimObject based variable on a non-SimObject.

[error.60]
error=Failed to execute material script "test.lua": Attempted to access SimObject based variable on a non-SimObject.

[error.61]
error=Failed to execute material script "test.lua": Attempted to access SimObject based variable on a non-SimObject.

[error.62]
error=Failed to execute material script "test.lua": Attempted to access SimObject based variable on a non-SimObject.

[error.63]
error=Failed to execute material script "test.lua": Attempted to access SimObject based variable on a non-SimObject.

[error.64]
error=Failed to execute material script "test.lua": Attempted to access SimObject based variable on a non-SimObject.

[error.65]
error=Failed to execute material script "test.lua": Attempted to access SimObject based variable on a non-SimObject.

[error.66]
error=Failed to execute material script "test.lua": Attempted to access SimObject based variable on a non-SimObject.

[error.67]
error=Failed to execute material script "test.lua": Attempted to access SimObject based variable on a non-SimObject.

[error.68]
error=Failed to execute material script "test.lua": Attempted to access SimObject based variable on a non-SimObject.
Which in essence says that LUA scripting in general works for simobjects only.

Has anyone got this to work with terrain models, buildings etc.?
From the PBR scenery announcements so far I have seen that the few of them that do rain variations are using the old fallback to SODE?

Bests,
Sascha
 

Christian Bahr

Resource contributor
Which in essence says that LUA scripting in general works for simobjects only.
You can be sure that LUA scripts work for both Simobjects and BGL objects. It is however important to use the correct formatting of the variables.

It can very well be that a simobject does not have access to the path to the LUA script. It depends then on the method of how to add the simobject in the P3D. Usually, I register sceneries as add-on package in the Sim and reference the respective scene elements via the add-on.xml located in the installation directory. This works very well in the example of the Mercedes and it works perfectly for some of my scenes. You could try to put your LUA script in the directory "...\Prepar3D v4\Scripts", because there are also other LUA scripts needed by the P3D.
 
Hello all
can anyone tell me how to use the TextureOffset variable

i tried making my own A var and assign it in the material scripts but it doesn't work
if I set the diffuse texture to null I get a white texture = it means the script is getting loaded but if I change the offset of the Uvs it just doesn't work

here is my script plz help


Code:
!lua

local U = varget("A:MyVar_U", "degrees")
local V = varget("A:MyVar_V", "degrees")

varset("T:TextureCoordOffsetU ", "Number", U)
varset("T:TextureCoordOffsetV ", "Number", V)
 

n4gix

Resource contributor
Make up your own "A variables?" The letter "A" is reserved in the sim for "Aircraft" variables. We should be using "L variables" for our own made-up variable names.

Since you report that it works, perhaps the sim doesn't really care, but it is horribly confusing... :stirthepo
 
i don't know how to make L vars :| if you know a way to do it please do let me know
but for A vars, you can use P3D PDK to make them
 

n4gix

Resource contributor
i don't know how to make L vars :| if you know a way to do it please do let me know
but for A vars, you can use P3D PDK to make them
The exact same way that you used for A:vars. I've actually have never looked into the PDK yet, as I'm still creating for both FSX and P3D so things need to work in both to avoid having two development streams.
 

n4gix

Resource contributor
I have no idea honestly. As I said previously, I've not even looked at the PDK yet. However, if your A:vars work properly, then don't worry about it! :wave:
 

n4gix

Resource contributor
how do you make L vars in FSX ? (not for gauges)
Just the act of naming it is all that is required. L:vars can be created in a modeldef.xml script, or a gauge. Like A:vars, L:vars are Global and can be read any place within the sim's envelope.
 
Top