Dynamic lighting

arno

Administrator
Staff member
FSDevConf team
Resource contributor
#1
I have finished a new feature for ModelConverterX, so just in time as a big Christmas present to all ModelConverterX users. Since my summer vacation in July I had an idea how I wanted to support the new dynamic lighting feature of Prepar3D v4 and now I have finally implemented it. This means that you can use ModelConverterX to preview the dynamic lighting and to generate the effect files that place the dynamic lights. You will find this new feature in the latest development release. I’ll explain how it works in this blog post.

If you are loading an object that includes special effects with dynamic lighting, make sure you have the rendering of the spot lights enabled in ModelConverterX. That’s the button I encircled in red in the image on the right. If this button is off, ModelConverterX will not render the spot lights for you.

If you want to add a new spot light to your object, you can do this from the Attached Object Editor. In the Add drop down menu you will find a new object for Spot light. This will add a spot light object to your model. Using the Attached Object Editor you can now tweak and position the spot light.

In the image below you see the different properties that you can set for a spot light. Setting the position and orientation works like any other attached object.

In the Light category you can specify the color of the spot light and if it should be blinking or not. In that case you need to enter a duration value for the blinking.

The Spot light category contains all settings that are unique for the spot light. This includes the inner and the outer cone, the range up to which the light is effective and the strength of the light. All these values have affect on the rendering in the preview. The special effect file is generated based on these values you enter.



If you have the rendering of attached objects enabled in the ModelConverterX preview, you will see the cone rendered visually as shown in the picture below. The brighter cone is the inner cone and the more darker one is the outer cone. If you change the values in the properties the cone rendering will change. The length of the cone is linked to the range that is specified for the spot light.



There is one other new feature I would like to mention. In the importer options you will find a new setting called “Replace effects by lights”. By default this is set to false, but if you set it to true ModelConverterX will try to replace the (spot) light effects in your model with (spot) light objects. This means that you can tweak all the properties like when you are creating them new. With the default value ModelConverterX will just load and show the special effect files. But then it is harder to change how the light looks.

I hope you will enjoy this new feature!

Continue reading...
 

Pyscen

Resource contributor
#2
Thanks Arno!! You have given quite alot! I assume that this (not as dynamic lighting), will make it easier to add lighting effects for FSX soon as well (thinking of those that are wishing for...)

Thanks Again for all that you have done for the FS community!! I hope that you and your family have a blessed Christmas!!
 

arno

Administrator
Staff member
FSDevConf team
Resource contributor
#3
Hi,

The dynamic lights are not for FSX. But adding light points could be done in the same way for a long time already.

Or do you have something extra for FSX in mind?
 

Pyscen

Resource contributor
#4
Yes,.. light points can be added already,.. but I don't think you can adjust the brightest of or even the color,... or am I wrong,... I haven't done it in awhile,... therefore, I'm not sure about it..
 

arno

Administrator
Staff member
FSDevConf team
Resource contributor
#5
Color can be set already. Brightness I need to check, that probably should work the same (but I haven't implemented it).
 

arno

Administrator
Staff member
FSDevConf team
Resource contributor
#7
The cone only applies to spot lights, so that would not be for FSX.
 
#8
Hi Arno,

Thanks for the awesome update. Can you please let us know what will be the effect file name saved and where it will be saved?

Edit:
I found the files are in the exported output folder and not sure I can change the effect file name. One more i found the effects are visible during day time too. Is there any ways to off it during day time and make it only visible during night or during dark/raining situation? I think if effect parameters option is added, the problem will be solved.
 
Last edited:

arno

Administrator
Staff member
FSDevConf team
Resource contributor
#9
Hi,

If you rename the effects, you need to update the model as well, since that references the filename.

Adding an option for night only is a good idea, I never did that for the other lights either. Would require some extra effect parameters to be added on export. That is a good idea.
 
#10
Hi,

If you rename the effects, you need to update the model as well, since that references the filename.
I think the previous effects for fsx has an option to set the parameter as dawn, day, dusk and night. If the similar parameters were set, then that might help solve the day light effect problem.

Another suggestion, maybe you can set a value for example:
Let say <0.3 (dark) - >0.31-1 (day/brighter), if the value is 0.3 then the light will be shown in the sim. If it is more than 0.31- 1, then it won’t lights up. (I’m not sure this kind of attributes will be able to read by the sim). The value of 0-0.3 is a range of numbers showing the darkness of environment. Maybe this kind of numbers can even allow us to see the lights even when raining/thunderstorms where the environment become darker from the normal situation. This means the light will not only follow the day/dawn/dusk/night options but will lights up if the environment is getting darker because of any situation (like rain) even it was 12 noon. I think that is how normal road lights are set in real life where it follow the ‘photosensors’ to lights up.

2. Can ‘Effect Name’ option to be added to the spot light effect option so that the effect (.fx) file will be saved under the name we specify and not based on the setting we set under the spotlight options? This might save a lot of time in case we just need to change the model and not the effect we have already created previously. So we just can choose the effect and export the model.

These are just my suggestions Arno. I’m not sure what I’m telling can be created because you know very well how you created the coding. I have no coding knowledge at all .
 
#11
Thanks for that christmas gift! It is an awesome feature.

Two little things, though:

  • I can't see the light on the ground in the preview. Is there something else, I have to swtich on except spotlights? I can see the beams just fine
  • It works very good. But when I am not happy with the result in the simulator and load the model again, I can't change the parameters anymore (in MCX). I guess it is a good idea to leave MCX open, until you are happy with the result.
Thanks again. I guess, I will use it quite a lot, not only for my own sceneries, but also for others, that don't come with dynamic lighting.
 

arno

Administrator
Staff member
FSDevConf team
Resource contributor
#12
I think the previous effects for fsx has an option to set the parameter as dawn, day, dusk and night. If the similar parameters were set, then that might help solve the day light effect problem.
Yes, I should probably use these. But also for the normal lights (not the spot lights) I don't have this option in MCX now. Would be a good idea to add it to both. I'll put it on the todo list.

2. Can ‘Effect Name’ option to be added to the spot light effect option so that the effect (.fx) file will be saved under the name we specify and not based on the setting we set under the spotlight options? This might save a lot of time in case we just need to change the model and not the effect we have already created previously. So we just can choose the effect and export the model.
I'm using these auto-generated names on purpose. That why you prevent that many people will all create the same white light with many different names. Then it is more efficient to have one name based on the properties. That why I can also read back the light into a light object that can easily be edited on import. So I don't think it's a good idea to add a user specified name.
 

arno

Administrator
Staff member
FSDevConf team
Resource contributor
#13
I can't see the light on the ground in the preview. Is there something else, I have to swtich on except spotlights? I can see the beams just fine
Did you toggle the display of the ground in MCX? By default it is not shown and then the spot light has nothing to reflect on.

It works very good. But when I am not happy with the result in the simulator and load the model again, I can't change the parameters anymore (in MCX). I guess it is a good idea to leave MCX open, until you are happy with the result.
Like I mentioned at the end of my blog post, there is a new option now that will on import convert the effect to a light object where all properties can be edited. So put that option to true and it should work the way you want.
 
#14
Hi;
First thank you Arno for your great work, it is greatly appreciated.

I'm trying to create the Spotlight effect (on a post that i have) that you explane here in MCX, but i'm surely missing something...

Here is what i do;

1= i create the spot light like you show here and it look good in MCX
2= i create a new GUID for the Spotlight and compile it in a Library
3= when i import the new Library in MCX; the spot light does not show up !
4= when i try to see it in P3DV4 it is not there, only two small light at the top of the post
 

Attachments

arno

Administrator
Staff member
FSDevConf team
Resource contributor
#15
Hi;
First thank you Arno for your great work, it is greatly appreciated.

I'm trying to create the Spotlight effect (on a post that i have) that you explane here in MCX, but i'm surely missing something...

Here is what i do;

1= i create the spot light like you show here and it look good in MCX
2= i create a new GUID for the Spotlight and compile it in a Library
3= when i import the new Library in MCX; the spot light does not show up !
4= when i try to see it in P3DV4 it is not there, only two small light at the top of the post
Do you compile as P3D v4 mdl? That's the only format that supports the spot lights. For other versions a normal light is created.
 
#16
Hi;
Thank you for the quick response;-)

But i'm still having the same probleme.

i downloaded the latest « Library creator » version 3.0.0

entered the path for P3Dv4, where i think it is necessary but:

in the Library creator screen, in the bottom left, it say FSX !
in the save portion the « save Library XML » is grayed out. i cannot change it but i entered the path just to be sure
in Library Creator, i do not see where the compile window is.
in MCX, i show you the exporter setting, so you can check if all is OK
 

Attachments

#17
Hi,
nice job Arno!
the dynamic effects I created did not need presects day / night and dawn / dusk so far, they were active all the time except the day 'added with "Add effects"

When I replace the effect generated by one of mine, there is no need to adjust the parameters, what can be the difference between my fx and the effect generated by MCX?
 

arno

Administrator
Staff member
FSDevConf team
Resource contributor
#18
Hi,
nice job Arno!
the dynamic effects I created did not need presects day / night and dawn / dusk so far, they were active all the time except the day 'added with "Add effects"

When I replace the effect generated by one of mine, there is no need to adjust the parameters, what can be the difference between my fx and the effect generated by MCX?
Hi,

Can you send me your effect? Then I can compare the code.
 

arno

Administrator
Staff member
FSDevConf team
Resource contributor
#19
Hi;
Thank you for the quick response;-)

But i'm still having the same probleme.

i downloaded the latest « Library creator » version 3.0.0

entered the path for P3Dv4, where i think it is necessary but:

in the Library creator screen, in the bottom left, it say FSX !
in the save portion the « save Library XML » is grayed out. i cannot change it but i entered the path just to be sure
in Library Creator, i do not see where the compile window is.
in MCX, i show you the exporter setting, so you can check if all is OK
Hi,

If library creator mentions FSX I think in MCX it was exported as a FSX mdl instead of P3D v4.
 
#20
Hi,

Can you send me your effect? Then I can compare the code.
I noted the properties, removed in the generated effect, but no changes

[Library Effect]
Lifetime=5
Version=2.00
Radius=-1
Priority=0

[Properties]

[Emitter.0]
Lifetime=1.00, 1.00
Delay=0.00, 0.00
Bounce=0.00
Rate=1.00, 1.00
X Emitter Velocity=0.00, 0.00
Y Emitter Velocity=0.00, 0.00
Z Emitter Velocity=0.00, 0.00
Drag=0.00, 0.00
X Particle Velocity=0.00, 0.00
Y Particle Velocity=0.00, 0.00
Z Particle Velocity=0.00, 0.00
X Rotation=0.00, 0.00
Y Rotation=0.00, 0.00
Z Rotation=0.00, 0.00
X Offset=0.00, 0.00
Y Offset=0.00, 0.00
Z Offset=0.00, 0.00
Pitch=90.00, 90.00
Bank=0.00, 0.00
Heading=0.00, 0.00

[Particle.0]
Lifetime=0.00, 0.00
Type=28
X Scale=10.00, 10.00
Y Scale=0.00, 0.00
Z Scale=0.00, 0.00
X Scale Rate=0.00, 0.00
Y Scale Rate=0.00, 0.00
Z Scale Rate=0.00, 0.00
Drag=0.00, 0.00
Color Rate=0.00, 0.00
X Offset=0.00, 0.00
Y Offset=0.00, 0.00
Z Offset=0.00, 0.00
Fade In=0.00, 0.00
Fade Out=0.00, 0.00
Static=1
Face=0, 0, 0

[ParticleAttributes.0]
Color Start=0, 0, 0, 0
Color End=255, 255, 200, 110
Bounce=0.00
X Scale Goal=50.00
Y Scale Goal=50.00
Z Scale Goal=0.00
Falloff Exponent=2.00
Inner Cone Angle=15.00
Outer Cone Angle=120.00
 
Top