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.
!lua
if varget("A:LIGHT STATES", "Mask") & 0x0004 > 0 then
varset("T:EmissiveTexture", "string", "Bev_01_night.dds")
varset("T:EmissiveScale", "number", 0.25)
else
varset("T:EmissiveTexture", "string", "")
end
Could you please try that with precipitation lua script with PBR materials?Did this test with an aircraft model, using the following steps, basically replicating the F-16 pattern:
1- Created a 'script' folder within the aircraft folder.
2 - added a script called 'Bev_01_night.lua' to the folder using mask 0x0004, which is the landing lights identifier:
Code:!lua if varget("A:LIGHT STATES", "Mask") & 0x0004 > 0 then varset("T:EmissiveTexture", "string", "Bev_01_night.dds") varset("T:EmissiveScale", "number", 0.25) else varset("T:EmissiveTexture", "string", "") end
3-- added Bev_01_night.dds to the aircraft's texture folder.
4 -- added the name of the lua file to one of the materials in MCX's material editor. (Note, did not specify an emissive file.)
5 -- compiled the model to V 4.4 / 4.5
6 -- Loaded the model in sim and turned landing lights on and off -- worked fine.
I suspect there is problem with MCX to MDL 4.4 export. When i load the model from here into P3D, everything works finely. Then, I import the similar MDL file into MCX and add PBR materials and export back to MDL v4.4. I placed the new MDL model into similar location replacing the oldest one. Loaded P3D and the script is not working. So where is the problem actually? Is it in MCX itself or the XtoMDL export is not saving the value into MDL file?
To double confirm this, i created my own cube and added the similar script into the model and add texture. Load up into P3D, everything works. But, when i export into MDL v4.4 with PBR texture, then it's not working.
Could you please try that with precipitation lua script with PBR materials?
!lua
--Get precip state.
local raining = 0x00000004
local precipState = varget("A:AMBIENT PRECIP STATE", "Mask")
precipState = math.floor(precipState)
--Define textures.
textureDry= "mercedes_cls_diffuse_dark_blue.dds"
textureWet = "mercedes_cls_diffuse_gold.dds"
if precipState == raining then
varset("T:DiffuseTexture", "string", textureWet)
else
varset("T:DiffuseTexture", "string", textureDry)
end
Hi.
I'm not sure if that's what you mean. But out of boredom and out of pure curiosity I wrote a little LUA script some time ago. This script ensures that the texture of a vehicle changes as it starts to rain ...
View attachment 49564
Code:!lua --Get precip state. local raining = 0x00000004 local precipState = varget("A:AMBIENT PRECIP STATE", "Mask") precipState = math.floor(precipState) --Define textures. textureDry= "mercedes_cls_diffuse_dark_blue.dds" textureWet = "mercedes_cls_diffuse_gold.dds" if precipState == raining then varset("T:DiffuseTexture", "string", textureWet) else varset("T:DiffuseTexture", "string", textureDry) end
Even if it is not PBR textures, it helps a bit further. And maybe someone who is more familiar with LUA can check the consistency of the script.
The Mercedes I have put together as an Addon Package. To test the vehicle and the LUA script you should add the Mercedes CLS as Add-on Package in P3Dv4
Is this a PBR material or a standard one?
How was the workflow to achieve this? Max, export MDL, library? or MCX?
In 3dsmax did you add some Diffuse texture image or left it blank?
Thanks. I will try that. Last time I tried was not different from what you have, the only different thing I did was to specify the diffuse image in 3ds max. Hope with out specifying it works.This is standard P3D material, no PBR material.
Material settings and export via 3dsm as mdl file.
The diffused channel can remain empty, the textures are assigned by the script during runtime in the P3D.
View attachment 49566
You are correct. Based on the material variables' section in the SDK, PBR texture has different script.I just had a look at the script and it seems to change the diffuse texture based on a raining state. For a PBR material would it not have to change the albedo texture instead? Seems to me that you can't use the same script with PBR materials.
varset("T:DiffuseTexture", "string", "YOUR TEXTURE.DDS")
varset("T:AlbedoTexture", "string", "YOUR TEXTURE.DDS")
Thanks for the attachment and codes.Hi.
I'm not sure if that's what you mean. But out of boredom and out of pure curiosity I wrote a little LUA script some time ago. This script ensures that the texture of a vehicle changes as it starts to rain ...
View attachment 49564
Code:!lua --Get precip state. local raining = 0x00000004 local precipState = varget("A:AMBIENT PRECIP STATE", "Mask") precipState = math.floor(precipState) --Define textures. textureDry= "mercedes_cls_diffuse_dark_blue.dds" textureWet = "mercedes_cls_diffuse_gold.dds" if precipState == raining then varset("T:DiffuseTexture", "string", textureWet) else varset("T:DiffuseTexture", "string", textureDry) end
Even if it is not PBR textures, it helps a bit further. And maybe someone who is more familiar with LUA can check the consistency of the script.
The Mercedes I have put together as an Addon Package. To test the vehicle and the LUA script you should add the Mercedes CLS as Add-on Package in P3Dv4
Unfortunately I can not answer exactly. The error logging in the P3D I have switched offOne last questions. In the error log of P3d when you closes it there appear some script errors? Is this normal?
I tried that with the Porsche Carrera GT, however without coming to a success. But maybe I'll find the time and pleasure again and try again. Raindrops on the car windows would be pretty coolThe standard precipitation script in folder 'scripts' (PrecipWindshieldEffect.lua) can be used to tweak a VC_reflection material to show moving raindrops on the windshield -- just copy the V4 Mooney material parameters and export as V4.4/5.
I tried this but couldn’t see the effects on the windshield of the car.The standard precipitation script in folder 'scripts' (PrecipWindshieldEffect.lua) can be used to tweak a VC_reflection material to show moving raindrops on the windshield -- just copy the V4 Mooney material parameters and export as V4.4/5.