Engine lights

View previous topic View next topic Go down

Engine lights

Post by Dexter on Tue Jun 17, 2014 12:40 am

Hello guys,

I was thinking if someone can advise me on train lights. I have been able to create the "light" effect for the 163 engine, but for some reason, the light is not visible from inside the loco. The light effect code is as follows:

Code:
CreateMeshBuilder,
Cylinder, 32, -0.08, -4, 15
Rotate,1,0,0,85
Translate,0,-0.65,-7.5
SetColor,250,245,226,20
SetEmissiveColor,250,245,226


It is just a work version, but I am sort of sure it would be visible from a 3D cab. Is there any solution for a 2D cab as well?
avatar
Dexter

Posts : 1824
Join date : 2011-07-08
Age : 31
Location : Brno, Czech republic

http://www.brnobve.eu

Back to top Go down

Re: Engine lights

Post by leezer3 on Tue Jun 17, 2014 2:00 am

Whilst in a 2D cab, I don't believe the exterior objects are rendered at all, and therefore the short answer to your question is not easily AFAIK.

Dennis Lance did some playing with the ambientlight and directionallight parameters at one stage, but I'm not sure anyone went any further than that.

This is an off the top of my head thought/ fudge though (I haven't tested or attempted to implement this, but I think the theory is sound as it's not trying to do anything remotely interesting):
In your routefile add a new rail with an associated dike/ wall. (I use rail 99 for weather effects)
Create an object for each curve radius with one rising plane of transparency to the height of your headlights beam.
Set these objects to be emissive from both sides at an appropriate color.
Build an animated file to trigger the objects when the headlights are lit.
Finally, set fog to the approximate view distance of your headlights.

TBQH, if that works, you'd probably get away with a single straight object, but the lighting would probably look better on curves with the curved variants.

I'll try and do some proper cooking at some stage and see what I can come up with.

Cheers

Chris Lees

http://www.bvecornwall.co.uk

leezer3

Posts : 875
Join date : 2011-08-23

http://www.bvecornwall.co.uk

Back to top Go down

Re: Engine lights

Post by Dexter on Tue Jun 17, 2014 2:06 am

Come to think of it, I could probably create an animated object that would travel along with the train. However, this is not so easy either, as the Translate functions only know uncurved directions and are unable to follow a certain rail. You are probably right the exterior parts of the engine don't work while in a 2D cab, that would explain the pantograph occurrences I have had recently.
avatar
Dexter

Posts : 1824
Join date : 2011-07-08
Age : 31
Location : Brno, Czech republic

http://www.brnobve.eu

Back to top Go down

Re: Engine lights

Post by leezer3 on Fri Jun 20, 2014 1:52 am

Good and bad news Razz
I've just remembered an OpenBVE bug I found when building the 81xx-
If you setup your train.dat in exactly the right way and use a .animated object for this first car, this will show up in the sim. (In my case it was a randomly floating along front pony truck...)

The bad news is that animations don't seem to work right on this 'object', so you're stuck with it as is.

The attached file is a modified train.dat (It needs the car length to be 0.01, and most of the numbers to be the exact length they are in there), extensions.cfg & headlight object.

Don't know how far it'll get you, as you'd need separate trains for headlights on and off, but it's an interesting curiosity if nothing else.

Cheers

Chris Lees

http://www.bvecornwall.co.uk
Attachments
163-133-7v4.zip You don't have permission to download attachments.(3 Kb) Downloaded 0 times

leezer3

Posts : 875
Join date : 2011-08-23

http://www.bvecornwall.co.uk

Back to top Go down

Re: Engine lights

Post by Dexter on Fri Jun 20, 2014 1:56 am

Yeah, the solution is a bit similar to the "bogies" thing. So, you are saying if I put a simple state change, it is not gonna work for me? I might as well put it at the end of the train and just substract the corresponding value... but it would be rotating incorrectly in curves alright. :-(
avatar
Dexter

Posts : 1824
Join date : 2011-07-08
Age : 31
Location : Brno, Czech republic

http://www.brnobve.eu

Back to top Go down

Re: Engine lights

Post by Northern Line on Fri Jun 20, 2014 9:28 am

Could be achieved if OpenBve ever reached that potential
avatar
Northern Line

Posts : 278
Join date : 2011-07-12
Age : 23
Location : Tooting, London, England

http://www.bve-district.co.uk/

Back to top Go down

Re: Engine lights

Post by Sponsored content


Sponsored content


Back to top Go down

View previous topic View next topic Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum