• Which the release of FS2020 we see an explosition of activity on the forun and of course we are very happy to see this. But having all questions about FS2020 in one forum becomes a bit messy. So therefore we would like to ask you all to use the following guidelines when posting your questions:

    • Tag FS2020 specific questions with the MSFS2020 tag.
    • Questions about making 3D assets can be posted in the 3D asset design forum. Either post them in the subforum of the modelling tool you use or in the general forum if they are general.
    • Questions about aircraft design can be posted in the Aircraft design forum
    • Questions about airport design can be posted in the FS2020 airport design forum. Once airport development tools have been updated for FS2020 you can post tool speciifc questions in the subforums of those tools as well of course.
    • Questions about terrain design can be posted in the FS2020 terrain design forum.
    • Questions about SimConnect can be posted in the SimConnect forum.

    Any other question that is not specific to an aspect of development or tool can be posted in the General chat forum.

    By following these guidelines we make sure that the forums remain easy to read for everybody and also that the right people can find your post to answer it.

P3Dv4 Material Scripting

Christian Bahr

Resource contributor
Messages
951
Country
germany
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.
 

fs1

Messages
301
Country
brazil
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
Messages
951
Country
germany
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 ...?
 

Lagaffe

Resource contributor
Messages
860
Country
france
I think that "render-to-texture" is the process to use in order to make miror in a VC ... Am I wrong ?
 

Christian Bahr

Resource contributor
Messages
951
Country
germany
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
Messages
951
Country
germany
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.
 
Messages
138
Country
poland
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
Messages
951
Country
germany
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.
 
Messages
578
Country
france
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
Messages
11,674
Country
unitedstates
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
 
Messages
578
Country
france
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
Messages
11,674
Country
unitedstates
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.
 
Messages
578
Country
france
my way to make A vars is using pdk ISimobject, it is P3D only
is there a way to make a DLL that make LVar
 

n4gix

Resource contributor
Messages
11,674
Country
unitedstates
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
Messages
11,674
Country
unitedstates
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