Page 1 of 2 12 LastLast
Results 1 to 10 of 19

Thread: Need help with Engine light.

  1. #1
    Join Date
    Mar 2009
    Location
    Georgia, US
    Posts
    561

    Default Need help with Engine light.

    Ok. I am almost happy with my attempt to add an engine light but I am running into some difficulties.

    First things first. It is almost impossible to create this affect and have it look good from both outside the cab and inside the cab. My concentration has been from inside the cab since that is how I usually run the game.

    Secondly. There is no easy way to have this item show from inside the cab unless I design the cab and somehow include it in the 3d model. This is not going to happen so I need a work around. I can replace the front coupler with my graphic and it shows both outside and inside the cab but of course, there is no front coupler. Even if that was ok with everyone, it requires messing with the engine files.

    Thirdly. I do not know of a way to turn the affect on and off from within the engine. Right now it is always on which makes any train I use this effect on uselss in the daytime since it looks bad.

    I remember from using MSTS that someone created an invisibile car that you attached to trains and it sounded the horn automatically for any train it was attached to. Anyone have any ideas along this front to get this object to attach to the front of the engine without losing the front coupler functionality? I even tried attaching it to a boxcar and attaching that behind the engine and it would display but as you can imagine not always point in the direction of the engine so it did not look right.

    What I would really like in order of priorities is:

    1. Easy to add on to existing engines without having to edit files.
    2. Does not require swapping out assets that already exist.
    3. Does not hurt the functionality of the coupler.
    3. Can be turned on and off with the headlamp switch or some other switch.

    I do not know how to create a coupler model (buckeye) or any other model for that matter other than the most basic forms, like a plane or a box..

    Some of you graphics wiz kids can figure this out but I have read the docs and they just simply do not provide the basic information needed to create a coupler from scratch. I do have access to 3ds max so I can play around or import a created coupler max file and then attach my shapes to it but to create one from scratch is beyond me and it would look horrible.

    I will try posting a video but I have to download fraps I guess to get a trial version so you can see what it looks like so far. It is by no means perfect but does provide a little better illusion than just a flat plane of light on the ground.

    Pike

    The videos

    https://www.youtube.com/watch?v=H91OHcOF5zw
    https://www.youtube.com/watch?v=5TyvlEVafc4
    https://www.youtube.com/watch?v=Foaks-7j5f4
    https://www.youtube.com/watch?v=w4DXN3xxn9w
    https://www.youtube.com/watch?v=GI39wFKEsIo
    Last edited by pikehkr; 09-18-2009 at 08:17 PM. Reason: Adding video link

  2. #2
    Join Date
    Nov 1999
    Location
    Oregon, USA.
    Posts
    385

    Default

    This was an experiment. It's nothing more than a ground-level quad with the appropriate texture, attached to the same quads that make the headlights glow.



    As you can see, I didn't model a light cone. If you think you might want to do that, think also of how things tend to get lit in real life. The "cone" is just the brightest part of the beam diffusing off micro-droplets of water and other particles in the air. Being the brightest part of the beam, the cone should "point to" the brightest part of the projected illumination on the ground. This will put the ground illumination fairly well out in front of the locomotive.

    As for Pike's list of priorities, here's my "thinking out loud" take.

    1. Easy to add on to existing engines without having to edit files.
    Can be done but you have to do some editing. As noted elsewhere (), one has to create the shape (a simple quad), make a Scenery blueprint for it, then hack the locomotive's bin file to add a child object referencing the new shape blueprint and the proper transform matrix (those blocks of code that begin
    <cHcRMatrix4x4>
    <Element>
    <e d:type="sFloat32" d:alt_encoding="000000000000F03F" dprecision="string">1.0000</e>

    and so on, for those of you who dig bin files).

    The Invisible Car approach would work up to a point. However, the illumination plane would be lit all the time. The locomotive's controls, specifically the H key, would have no effect on it. Moreover...
    2. Does not require swapping out assets that already exist.
    I assume this gets us back to the Invisible Car solution. In order to avoid the coupler problem, the locomotive would have to be modified ("swapped out?") to have a drawbar coupler in front. (Drawbar couplers are not drawn by the graphics engine.) The Invisible Car, which would be coupled to the front of the engine, would need a drawbar on its rear and a Type E in front.
    3. Does not hurt the functionality of the coupler.
    Oops! No can do. Honestly, I really don't think the Invisible Car approach gains us anything. Either way you have to hack the locomotive's coupler properties or its child-object properties.
    4. Can be turned on and off with the headlamp switch or some other switch.
    Having tried the child-object approach, I have to conclude that it either doesn't work or that I did something wrong. The illumination planes just stayed "lit" all the time. I named them properly and everything but they didn't respond to the H key. As previously noted, the screen shots you see here have "built-in" illumination planes.

    The docs...just simply do not provide the basic information needed to create a coupler from scratch.
    In the Rail Simulator days, RSDL provided a complete coupler asset download. The ones I use on my steamers are my own and are based on those principles.

    All this having been said, here's what I see as the down side.


    Our sun bathes the earth with a huge amount of light compared to an incandescent light. We all know that a light cone and projected light would be essentially invisible even on a cloudy day like the one depicted here. The available shaders that can be used for switchable headlights just don't take this into account. Yeah, you could make the ground-plane texture appear to be dimmer, but the night view would also be dimmer.

    And of course the biggest disadvantage of the method we've been talking about is that neither the cone nor the ground plane illuminate objects the way MSTS headlights do, or the way real headlights do for that matter. When it comes to properly rendering night scenes, RS.com has a bit of work to do--not just the headlights, but night cabs, and oh, that self-illuminated steam! Me, I'd just as soon wait until they get around to doing it right and implementing a true terrain/object-illuminating headlight.

    Hang in there, it'll happen.

  3. #3

    Default

    I'm not sure I can offer much positive help, but here's my thoughts on your list:

    1. To avoid existing file editing a MSTS style "invisible wagon" would probably be the only way to go. However, I think you'll get problems with setting up "fake" dimensionless wagon parameters because of Railworks more advanced physics system. The relationship of pivot points, collision box, cg position, bogie position, etc, is important and an invisible wagon may well be unstable. I think if you are able to devise a basic generic way to add lights to engines by blueprint editing then Mike Simpson may be prepared to add functionality to RWTools to automate editing for users.

    2. If you're referring to replacing the coupling to get a light view from inside the cab then sorry, I can't think of any other way.

    3a. As long as the coupling blueprint is the same, and you create a geometry which has separate objects named something like "1_0200_coupled" and "1_0200_uncoupled" (I can't remember the exact name convention, but it is described in the documentation) then the coupling should still operate, you just won't see the buckeye. It is possible to reference the existing buckeye geometry as a separate child object (via an appropriate scenery blueprint definition) to make it appear, but this is getting pretty convoluted.

    3b. Unfortuately I don't think anything defined as a coupling item can be turned on and off. However, for an external view child object it can be turned on and off with a bit of script in the engine simulation lua file "update()" function -
    If you have added child items named "Headlight1" and "Headlight2" to represent the front and rear headlights, and each contains an object called "1_0500_light" containing the light blob then something like the following should do it:

    Headlightswitch = Call( "*:GetControlValue", "Headlights", 0)
    if (Headlightswitch == 1) then
    Call ( "Headlight1:" .. "ActivateNode", "light", 1 )
    Call ( "Headlight2:" .. "ActivateNode", "light", 0 )
    elseif (Headlightswitch == 2) then
    Call ( "Headlight1:" .. "ActivateNode", "light", 0 )
    Call ( "Headlight2:" .. "ActivateNode", "light", 1 )
    else
    Call ( "Headlight1:" .. "ActivateNode", "light", 0 )
    Call ( "Headlight2:" .. "ActivateNode", "light", 0 )
    end

    Dave B
    Last edited by davveb; 09-19-2009 at 04:32 AM.

  4. #4
    Join Date
    Mar 2009
    Location
    Georgia, US
    Posts
    561

    Default

    Thanks for the input. I did manage to get the script working but only if I made the object a child of the engine. But of course if I do that, then it does not show up in the cab view.

    Like you said, I don't think I can do anything with the coupler and the headlight switch. I tried to fake it out.

    It is like a catch 22. Make it a child object and you can turn it on and off, just can't see it. Make it a coupler and you can see it but not turn it on or off.

    Try adding the coupler as a child object and you get nothing displaying outside or inside the cab.

    So, what, if any type of blueprint can be added as a child object and be visible in both cab mode and other modes? That is the question. And I suspect one doesn't exist because that would be too easy.

    Pike

  5. #5

    Default

    Unfortunately you are rather caught between a rock and a hard place. Scratchbuilding a cab is one way to do it, but this is obviously rather an extreme overkill of effort. By unrelated coincidence I'm actually in the middle of putting a cab together at the moment, and I may have a go at incorporating some of these "light blob" ideas, see if I can get any satisfactory results.

    Dave B

  6. #6
    Join Date
    Dec 2007
    Location
    Clarksville, TN and Cortona, Italy
    Posts
    1,529

    Default Light at night?

    I remember once having tried to strap a flashlight to my bicycle handlebars so my parents would let me ride after dusk. That didn't work so well, either. Buried somewhere in the RS forums are gabizallions of posts related to whether or not locomotives of various eras even had lights designed to illuminate the tracks ahead. Anyone for a snipe hunt?

    Tom Pallen

  7. #7
    Join Date
    Nov 1999
    Location
    Oregon, USA.
    Posts
    385

    Default

    I'm sure most of you know this already, but...

    If the projected light is an object that's part of the locomotive model, whether it's a child object or built into the model itself, it won't show up in cab view. That's because the cab is a separate model which replaces the locomotive. In order to conserve resources, the locomotive model isn't drawn. And since the locomotive isn't drawn, neither is the projected light object.

    You can see the projected light object in headout view because in that case you are looking at the actual locomotive model.

    In MSTS the projected light is visible in cab view as well as the exterior views, because in MSTS the light cone actually affects the way the terrain and other objects are drawn.

    I think I'll just stick with daylight running until RailWorks fills this gap from its MSTS legacy. Until that happens, and unless people start clamoring for it (which so far they haven't), I have no plans to modify my own products with what to me is a not-so-effective kludge. Just my own &^%$ opinion!

  8. #8
    Join Date
    Mar 2009
    Location
    Georgia, US
    Posts
    561

    Default

    Just a thought... would it be possilbe to create a "light" emitter? An emitter that uses an AddATex material? I don't know enough to know if that would even work or how much control you have over an emitter.

    Just wondering. Are those visible from the cab view?


    Pike

  9. #9
    Join Date
    Aug 2005
    Location
    Smithsburg, MD. USA.
    Posts
    1,053

    Default

    Quote Originally Posted by ricksan View Post
    I'm sure most of you know this already, but...
    If the projected light is an object that's part of the locomotive model, whether it's a child object or built into the model itself, it won't show up in cab view. That's because the cab is a separate model which replaces the locomotive. In order to conserve resources, the locomotive model isn't drawn. And since the locomotive isn't drawn, neither is the projected light object.
    In Pike's last video you can see the lights from inside the cab.

    Pike are you going to share this or is this a WIP? Looks nice so far.
    Tom

  10. #10
    Join Date
    Mar 2009
    Location
    Georgia, US
    Posts
    561

    Default

    It's a wip and it replaces and makes the front coupler non-functional. That is what we are discussing as I do not like that option.

    Pike

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •