Lighting Question

Post your problems and installation issues here!

Lighting Question

Unread postby gkbaldwin » Fri Jun 17, 2016 5:41 pm

Hi;

I have been playing around on adding some lights to locomotives. The specific one I am working on the the Sherman Hill UP SD40-2. I have added and got working low beam headlights (simulated) with forward glow. Right now they are on all the time. I want to controlthem via keyboard key. I can add a new keyboard input for them, but don't know specifically how to associate the lights to the new input key mapping or associate them with an existing keyboard mapping. Does this information have to be added to the associated script? I know there is a way to add to an existing compressed script, but I have never gotten it to work. Any help would be much appreciated.

Gerry
You do not have the required permissions to view the files attached to this post.
gkbaldwin
 
Posts: 227
Joined: Wed Aug 24, 2011 11:02 am

Re: Lighting Question

Unread postby jalsina » Sat Jun 18, 2016 10:08 pm

I have never worked on loco light effects so I am on the blind here.
You should define any control in the engine bin. The input mapper file is called once in that bin. You may add a new keystroke in the mapper, but the key should be specified somewhere in the engine bin to produce the lighting you want.
Many headlights effects are also set using child objects in the children code group normally at the final part of the file.
May be someone more experienced can detail or change what I have posted.
Intel i7-7900K (3.60 GHz) - ASUS Prime Z390A - 32 GB DDR4 RAM 2400 MHz
GPU EVGA GTX-1060 OC 6GB at 1920x1080, 144 Hz - Monitor ASUS VG-248QE
System Windows 11 Pro in WD SSD 500 GB. Games in Inland 1Tb M.2 NVMe PCIe
User avatar
jalsina
 
Posts: 2010
Joined: Sun Jul 05, 2015 8:32 pm

Re: Lighting Question

Unread postby gkbaldwin » Sun Jun 19, 2016 9:19 am

Thank you for the feedback.

The lighting is created with adding child objects (three -2 lights, 1 foward glow) to the engine.bin file. Also added the control information to the engine.bin file and added a keyboard input control to the input mappers file for that engine. Been working on a script specific to the new lights (right now ignoring the primary engine script for testing purposes), but to no success (scripting is clearly my weak point). I don't even know if this is possible, but don't know any reason why it shouldn't work.

This is crazy. Gerry
gkbaldwin
 
Posts: 227
Joined: Wed Aug 24, 2011 11:02 am

Re: Lighting Question

Unread postby jalsina » Sun Jun 19, 2016 10:34 am

I can see you are already several steps forward to what I have posted. !!*ok*!!
Intel i7-7900K (3.60 GHz) - ASUS Prime Z390A - 32 GB DDR4 RAM 2400 MHz
GPU EVGA GTX-1060 OC 6GB at 1920x1080, 144 Hz - Monitor ASUS VG-248QE
System Windows 11 Pro in WD SSD 500 GB. Games in Inland 1Tb M.2 NVMe PCIe
User avatar
jalsina
 
Posts: 2010
Joined: Sun Jul 05, 2015 8:32 pm

Re: Lighting Question

Unread postby mrennie » Sun Jun 19, 2016 12:01 pm

Have a look at this snippet of code extracted from the FEF-3's engine script. It's part of the function UpdateMarsLight(), which is called from the Update function :

Code: Select all
function UpdateMarsLight()

...

            elseif gMarsLightSelectorValue == cMarsSteady then
         
               Call( "LightsBellTrainNumbersSmokeboxBrackets:ActivateNode", "MarsGlassLightOff", 0 )
               Call( "LightsBellTrainNumbersSmokeboxBrackets:ActivateNode", "MarsGlassLightOn", 1 )

               Call( "MarsLightEmissiveOscillating:ActivateNode", "MarsLightEmissive", 0)
               Call( "MarsLightEmissiveSteady:ActivateNode", "MarsLightEmissive", 1)

               Call( "MarsProjectedLightOscillating:Activate", 0 )
               Call( "MarsProjectedLightSteady:Activate", 1 )
               


There are two main things to notice about the Mars light.

Firstly, it has nodes in the child object ("LightsBellTrainNumbersSmokeboxBrackets") geometry model (.igs file) - nodes for the light and its lens (there's a node for the lens glass when it's on and glowing, and another for when it's off and darker) and other nodes to handle the animation when the light is oscillating.

In your case you need to activate/deactivate the nodes that have the glowing or non-glowing textured surfaces, depending on the status of the light - that what calls such as Call( "LightsBellTrainNumbersSmokeboxBrackets:ActivateNode", "MarsGlassLightOff", 0 ) are there for.

Secondly, there are projecting light beams attached to the model - those are scenery blueprints (or animated scenery blueprints in the case of the oscillating beam) placed as child objects in the engine blueprint. Those child objects, in turn, contain their own child objects that are light emitters (made as headlight blueprints). For example, "MarsLightEmissiveSteady" is a child object in the engine blueprint. It's defined as a scenery blueprint and contains another child object called "MarsProjectedLightSteady" which references a headlight blueprint. The igs file referenced in "MarsLightEmissiveSteady" contains a model that has a node called "MarsLightEmissive". To turn on the Mars light with a steady beam, you switch on the glowing lens by activating the "MarsGlassLightOn" node in the "LightsBellTrainNumbersSmokeboxBrackets" child object, switch off the other lens, switch on the light emitter (the projecting beam of light) by activating the "MarsLightEmissive" node in the "MarsLightEmissiveSteady" child object and then its own "MarsProjectedLightSteady" child.

Yes, it's a bit a complicated. The complete code for the FEF-3 is even more complicated because of the oscillating or steady beam, the need to account for whether the generator is running, code to handle AI, code to handle the automatic activation of the Mars light (emergency braking) ...
User avatar
mrennie
 
Posts: 3219
Joined: Wed May 30, 2012 12:22 pm

Re: Lighting Question

Unread postby gkbaldwin » Sun Jun 19, 2016 2:33 pm

Hi Mrennie; Yes scripting is very complicated. The piece to refer back too, which I cannot seems to find anywhere is the node name, where you do the activatenode? I have looked through the engine.bin file and cannot see where the reference is regarding node names.

As for what I am and have done is to simulate low beam headlights on the locomotive. I have done this by adding child objects (small spotlights) on the off headlights lens, giving them the appearance of being on low beam. I also included a child object to show forward light (not unlike the headlight child objects, but being dimmed down). That's it. They show up fine right now, but are always on. I added a keyboard control key and cooresponding control input in the engine.bin file, but no matter what I do regarding the script to get them to work, nothing happens. They continue to stay on all the time. Sice I cannot look at the enginescript.out file to see what the headlight activenode name is I am at a loss as to where to find this?

Gerry
gkbaldwin
 
Posts: 227
Joined: Wed Aug 24, 2011 11:02 am

Re: Lighting Question

Unread postby mrennie » Sun Jun 19, 2016 4:14 pm

gkbaldwin wrote:Hi Mrennie; Yes scripting is very complicated. The piece to refer back too, which I cannot seems to find anywhere is the node name, where you do the activatenode? I have looked through the engine.bin file and cannot see where the reference is regarding node names.

As for what I am and have done is to simulate low beam headlights on the locomotive. I have done this by adding child objects (small spotlights) on the off headlights lens, giving them the appearance of being on low beam. I also included a child object to show forward light (not unlike the headlight child objects, but being dimmed down). That's it. They show up fine right now, but are always on. I added a keyboard control key and cooresponding control input in the engine.bin file, but no matter what I do regarding the script to get them to work, nothing happens. They continue to stay on all the time. Sice I cannot look at the enginescript.out file to see what the headlight activenode name is I am at a loss as to where to find this?

Gerry


The node names are in the actual model (inside the .geopcdx file). What sort of blueprint did you use for the child objects?

EDIT: I was thinking you'd made new objects (in Blender or 3DCrafter, for example) for the headlights and textured them to glow when activated, and then placed them as child objects attached to the engine.
User avatar
mrennie
 
Posts: 3219
Joined: Wed May 30, 2012 12:22 pm

Re: Lighting Question

Unread postby gkbaldwin » Sun Jun 19, 2016 6:07 pm

The test case I am using \ updating the RSC Sherman Hill SD40-2. For all three new child objects I used the existing Spotlight object geo file.
    [list=][url][/url]
[/list] (the node name is the same - thank you for showing me where that is locate). I updated the testenginescript (this is where I have no way of know if right or not) with this information but, no change. I must be doing somthng wrong in the script. !*don-know!*

Sorry if this is in the weeds. Gerry

Here is the added input:

Input Mapper

<iInputMapper-cInputMapEntry d:id="58642">
<State d:type="sInt32">0</State>
<Device d:type="cDeltaString">Keyboard</Device>
<ButtonState d:type="cDeltaString">ButtonDown</ButtonState>
<Button d:type="cDeltaString">Key_M</Button>
<ShiftButton d:type="cDeltaString">NoShift</ShiftButton>
<Axis d:type="cDeltaString">NoAxis</Axis>
<Name d:type="cDeltaString">ToggleControl</Name>
<Parameter d:type="cDeltaString">LowBeamLights</Parameter>
<NewState d:type="sInt32">0</NewState>
</iInputMapper-cInputMapEntry>
Engine.bin Control

<cControlContainerBlueprint-cControlValue d:id="27820">
<ControlName d:type="cDeltaString">LowBeamLights</ControlName>
<DefaultValue d:type="sFloat32" d:alt_encoding="0000000000000000" d:precision="string">0</DefaultValue>
<MinimumValue d:type="sFloat32" d:alt_encoding="0000000000000000" d:precision="string">0</MinimumValue>
<MaximumValue d:type="sFloat32" d:alt_encoding="000000000000F03F" d:precision="string">1</MaximumValue>
<BriefDescription d:type="cDeltaString">Low Beam Lights</BriefDescription>
<LocalisedControlName>
<Localisation-cUserLocalisedString>
<English d:type="cDeltaString"></English>
<French d:type="cDeltaString"></French>
<Italian d:type="cDeltaString"></Italian>
<German d:type="cDeltaString"></German>
<Spanish d:type="cDeltaString"></Spanish>
<Dutch d:type="cDeltaString"></Dutch>
<Polish d:type="cDeltaString"></Polish>
<Russian d:type="cDeltaString"></Russian>
<Other/>
<Key d:type="cDeltaString"></Key>
</Localisation-cUserLocalisedString>
</LocalisedControlName>
<DetailedDescription d:type="cDeltaString"></DetailedDescription>
<ApplyToConsist d:type="cDeltaString">eFalse</ApplyToConsist>
<HUDControlID d:type="sUInt32">0</HUDControlID>
<InterfaceElements>
<cControlContainerBlueprint-cInteriorPushButton d:id="27843">
<ElementName d:type="cDeltaString">Untitled</ElementName>
<DifficultyType d:type="cDeltaString">StopGo</DifficultyType>
<PickTransformName d:type="cDeltaString">LowBeamLights</PickTransformName>
<MovementType d:type="cDeltaString">PushButton</MovementType>
<AnalogInputSensitivity d:type="sFloat32" d:alt_encoding="0000000000001040" d:precision="string">4</AnalogInputSensitivity>
<DigitalInputSensitivity d:type="sFloat32" d:alt_encoding="0000000000001040" d:precision="string">4</DigitalInputSensitivity>
<AnimationName d:type="cDeltaString"></AnimationName>
<OutputInterface d:type="cDeltaString">eCab</OutputInterface>
<AutoRelease d:type="cDeltaString">eFalse</AutoRelease>
</cControlContainerBlueprint-cInteriorPushButton>
</InterfaceElements>
</cControlContainerBlueprint-cControlValue>

engine.bin added children

<cEntityContainerBlueprint-sChild d:id="53832448">
<ChildName d:type="cDeltaString">LowBeam_CD</ChildName>
<BlueprintID>
<iBlueprintLibrary-cAbsoluteBlueprintID>
<BlueprintSetID>
<iBlueprintLibrary-cBlueprintSetID>
<Provider d:type="cDeltaString">RSC</Provider>
<Product d:type="cDeltaString">ShermanHill</Product>
</iBlueprintLibrary-cBlueprintSetID>
</BlueprintSetID>
<BlueprintID d:type="cDeltaString">RailVehicles\Diesel\SD40-2\Default\Lights\SD40-2_Numbers_C.xml</BlueprintID>
</iBlueprintLibrary-cAbsoluteBlueprintID>
</BlueprintID>
<Matrix>
<cHcRMatrix4x4>
<Element>
<e d:type="sFloat32" d:alt_encoding="000000000000F03F" d:precision="string">1</e>
<e d:type="sFloat32" d:alt_encoding="0000000000000000" d:precision="string">0</e>
<e d:type="sFloat32" d:alt_encoding="0000000000000000" d:precision="string">0</e>
<e d:type="sFloat32" d:alt_encoding="0000000000000000" d:precision="string">0</e>
<e d:type="sFloat32" d:alt_encoding="0000000000000000" d:precision="string">0</e>
<e d:type="sFloat32" d:alt_encoding="000000000000F03F" d:precision="string">1</e>
<e d:type="sFloat32" d:alt_encoding="0000000000000000" d:precision="string">0</e>
<e d:type="sFloat32" d:alt_encoding="0000000000000000" d:precision="string">0</e>
<e d:type="sFloat32" d:alt_encoding="0000000000000000" d:precision="string">0</e>
<e d:type="sFloat32" d:alt_encoding="0000000000000000" d:precision="string">0</e>
<e d:type="sFloat32" d:alt_encoding="000000000000F03F" d:precision="string">1</e>
<e d:type="sFloat32" d:alt_encoding="0000000000000000" d:precision="string">0</e>
<e d:type="sFloat32" d:alt_encoding="0000000000000000" d:precision="string">0</e>
<e d:type="sFloat32" d:alt_encoding="0000000000001140" d:precision="string">4.25</e>
<e d:type="sFloat32" d:alt_encoding="0000006066661D40" d:precision="string">7.35</e>
<e d:type="sFloat32" d:alt_encoding="000000000000F03F" d:precision="string">1</e>
</Element>
</cHcRMatrix4x4>
</Matrix>
<ParentNodeName d:type="cDeltaString"></ParentNodeName>
</cEntityContainerBlueprint-sChild>
<cEntityContainerBlueprint-sChild d:id="53832448">
<ChildName d:type="cDeltaString">LowBeam_CU</ChildName>
<BlueprintID>
<iBlueprintLibrary-cAbsoluteBlueprintID>
<BlueprintSetID>
<iBlueprintLibrary-cBlueprintSetID>
<Provider d:type="cDeltaString">RSC</Provider>
<Product d:type="cDeltaString">ShermanHill</Product>
</iBlueprintLibrary-cBlueprintSetID>
</BlueprintSetID>
<BlueprintID d:type="cDeltaString">RailVehicles\Diesel\SD40-2\Default\Lights\SD40-2_Numbers_C.xml</BlueprintID>
</iBlueprintLibrary-cAbsoluteBlueprintID>
</BlueprintID>
<Matrix>
<cHcRMatrix4x4>
<Element>
<e d:type="sFloat32" d:alt_encoding="000000000000F03F" d:precision="string">1</e>
<e d:type="sFloat32" d:alt_encoding="0000000000000000" d:precision="string">0</e>
<e d:type="sFloat32" d:alt_encoding="0000000000000000" d:precision="string">0</e>
<e d:type="sFloat32" d:alt_encoding="0000000000000000" d:precision="string">0</e>
<e d:type="sFloat32" d:alt_encoding="0000000000000000" d:precision="string">0</e>
<e d:type="sFloat32" d:alt_encoding="000000000000F03F" d:precision="string">1</e>
<e d:type="sFloat32" d:alt_encoding="0000000000000000" d:precision="string">0</e>
<e d:type="sFloat32" d:alt_encoding="0000000000000000" d:precision="string">0</e>
<e d:type="sFloat32" d:alt_encoding="0000000000000000" d:precision="string">0</e>
<e d:type="sFloat32" d:alt_encoding="0000000000000000" d:precision="string">0</e>
<e d:type="sFloat32" d:alt_encoding="000000000000F03F" d:precision="string">1</e>
<e d:type="sFloat32" d:alt_encoding="0000000000000000" d:precision="string">0</e>
<e d:type="sFloat32" d:alt_encoding="0000000000000000" d:precision="string">0</e>
<e d:type="sFloat32" d:alt_encoding="0000000000001240" d:precision="string">4.5</e>
<e d:type="sFloat32" d:alt_encoding="0000006066661D40" d:precision="string">7.35</e>
<e d:type="sFloat32" d:alt_encoding="000000000000F03F" d:precision="string">1</e>
</Element>
</cHcRMatrix4x4>
</Matrix>
<ParentNodeName d:type="cDeltaString"></ParentNodeName>
</cEntityContainerBlueprint-sChild>
<cEntityContainerBlueprint-sChild d:id="28911">
<ChildName d:type="cDeltaString">LowBeam_CG</ChildName>
<BlueprintID>
<iBlueprintLibrary-cAbsoluteBlueprintID>
<BlueprintSetID>
<iBlueprintLibrary-cBlueprintSetID>
<Provider d:type="cDeltaString">RSC</Provider>
<Product d:type="cDeltaString">ShermanHill</Product>
</iBlueprintLibrary-cBlueprintSetID>
</BlueprintSetID>
<BlueprintID d:type="cDeltaString">RailVehicles\Diesel\SD40-2\Default\Lights\SD40-2_LowBeam_Headlight.xml</BlueprintID>
</iBlueprintLibrary-cAbsoluteBlueprintID>
</BlueprintID>
<Matrix>
<cHcRMatrix4x4>
<Element>
<e d:type="sFloat32" d:alt_encoding="000000000000F03F" d:precision="string">1</e>
<e d:type="sFloat32" d:alt_encoding="0000000000000000" d:precision="string">0</e>
<e d:type="sFloat32" d:alt_encoding="0000000000000000" d:precision="string">0</e>
<e d:type="sFloat32" d:alt_encoding="0000000000000000" d:precision="string">0</e>
<e d:type="sFloat32" d:alt_encoding="0000000000000000" d:precision="string">0</e>
<e d:type="sFloat32" d:alt_encoding="000000000000F03F" d:precision="string">1</e>
<e d:type="sFloat32" d:alt_encoding="0000000000000000" d:precision="string">0</e>
<e d:type="sFloat32" d:alt_encoding="0000000000000000" d:precision="string">0</e>
<e d:type="sFloat32" d:alt_encoding="0000000000000000" d:precision="string">0</e>
<e d:type="sFloat32" d:alt_encoding="0000000000000000" d:precision="string">0</e>
<e d:type="sFloat32" d:alt_encoding="000000000000F03F" d:precision="string">1</e>
<e d:type="sFloat32" d:alt_encoding="0000000000000000" d:precision="string">0</e>
<e d:type="sFloat32" d:alt_encoding="0000000000000000" d:precision="string">0</e>
<e d:type="sFloat32" d:alt_encoding="000000A0886C1140" d:precision="string">4.35599</e>
<e d:type="sFloat32" d:alt_encoding="0000000099611F40" d:precision="string">7.84531</e>
<e d:type="sFloat32" d:alt_encoding="000000000000F03F" d:precision="string">1</e>
</Element>
</cHcRMatrix4x4>
</Matrix>
<ParentNodeName d:type="cDeltaString"></ParentNodeName>
</cEntityContainerBlueprint-sChild>

TestEngineScript

function Initialise ()

Call( "BeginUpdate" )

end

function OnControlValueChange ( name, index, value )

if Call( "*:ControlExists", name, index ) then

if name == "LowBeamLights" then
gLowBeam = value

end

function Update ( time )

gLowBeam = 0

if gLowBeam == 1 then

Call( "LowBeam_CD:Activate", 1)
Call( "LowBeam_CU:Activate", 1)
Call( "LowBeam_CG:Activate", 1)

Call ( "ActivateNode", "spotlight", 1 )

else

Call( "LowBeam_CD:Activate", 0)
Call( "LowBeam_CU:Activate", 0)
Call( "LowBeam_CG:Activate", 0)

Call ( "ActivateNode", "spotlight", 0 )

end
gkbaldwin
 
Posts: 227
Joined: Wed Aug 24, 2011 11:02 am


Return to Problems and Peculiarities

Who is online

Users browsing this forum: No registered users and 1 guest

cron