Elvas Tower: Headlights in OR - Elvas Tower

Jump to content

  • 5 Pages +
  • « First
  • 2
  • 3
  • 4
  • 5
  • You cannot start a new topic
  • You cannot reply to this topic

Headlights in OR was Awaiting OR v1.0 Rate Topic: -----

#41 User is offline   Csantucci 

  • Member, Board of Directors
  • Group: Posts: Elite Member
  • Posts: 7,450
  • Joined: 31-December 11
  • Gender:Male
  • Country:

Posted 13 December 2014 - 08:39 AM

Thanks James.
Sorry, but I give it up. I see I should learn from scratch how to handle .fx files, and that's too much for me :lol2: .

#42 User is offline   James Ross 

  • Open Rails Developer
  • Group: Posts: Elite Member
  • Posts: 5,514
  • Joined: 30-June 10
  • Gender:Not Telling
  • Simulator:Open Rails
  • Country:

Posted 13 December 2014 - 08:55 AM

View PostCsantucci, on 13 December 2014 - 08:39 AM, said:

Thanks James.
Sorry, but I give it up. I see I should learn from scratch how to handle .fx files, and that's too much for me :lol2: .


.fx files can be thought of as a derivative of C, so pretty similar to C# in terms of basic syntax, but the most annoying bit is learning the available functions. You're welcome to ask questions in the forum if you'd like help learning them.

If you want to try another approach, adjusting the code in SharedMaterialManager.UpdateShaders and SceneryShader.SetHeadlight to pass a different lighting value in to the shader (see headlightPosition.SetValue in Shaders.cs on line 155) is an option. It's probably better than doing it in the shader. If you'd rather not try that, let me know and I'll give it a go. :)

#43 User is offline   Csantucci 

  • Member, Board of Directors
  • Group: Posts: Elite Member
  • Posts: 7,450
  • Joined: 31-December 11
  • Gender:Male
  • Country:

Posted 13 December 2014 - 01:10 PM

Ok, this is simpler, thank you :lol2: . I'm doing some test.

#44 User is offline   Csantucci 

  • Member, Board of Directors
  • Group: Posts: Elite Member
  • Posts: 7,450
  • Joined: 31-December 11
  • Gender:Male
  • Country:

Posted 13 December 2014 - 01:44 PM

In release 2709 there is my solution. At nighttime nothing changes. At daytime brightness is a fifth of nighttime. In the meantime (sun height between 0.15 and -0.05) there is a linearly interpolated value. Thanks again to James for the indispensable hints.

#45 User is offline   James Ross 

  • Open Rails Developer
  • Group: Posts: Elite Member
  • Posts: 5,514
  • Joined: 30-June 10
  • Gender:Not Telling
  • Simulator:Open Rails
  • Country:

Posted 13 December 2014 - 02:01 PM

View PostCsantucci, on 13 December 2014 - 01:44 PM, said:

In release 2709 there is my solution. At nighttime nothing changes. At daytime brightness is a fifth of nighttime. In the meantime (sun height between 0.15 and -0.05) there is a linearly interpolated value. Thanks again to James for the indispensable hints.


:lol2:

I think something's up with the interpolation, e.g. if you speed the game up to ~12,000% and watch the light during sunrise or sunset. At least for me, it doesn't seem to transition smoothly at all, instead jumping between a few different brightness levels. Not entirely sure why it jumps so much, but looking at the code I think the interpolation might be backwards. :)

#46 User is offline   Csantucci 

  • Member, Board of Directors
  • Group: Posts: Elite Member
  • Posts: 7,450
  • Joined: 31-December 11
  • Gender:Male
  • Country:

Posted 13 December 2014 - 02:11 PM

I'll check tomorrow morning, sorry.

#47 User is offline   Csantucci 

  • Member, Board of Directors
  • Group: Posts: Elite Member
  • Posts: 7,450
  • Joined: 31-December 11
  • Gender:Male
  • Country:

Posted 14 December 2014 - 12:18 AM

James, as - almost ;) - always you were right. The interpolation formula was reversed. After all reasonments, I had in mind that the interpolation should give out max value when sunset begun and min value when sunset ended ... exchanged sun brightness with headlight brightness... Corrected in release 2714. (Release 2713 doesn't build).

I think I will do some further test involving also distance when in daylight.

#48 User is offline   Csantucci 

  • Member, Board of Directors
  • Group: Posts: Elite Member
  • Posts: 7,450
  • Joined: 31-December 11
  • Gender:Male
  • Country:

Posted 14 December 2014 - 12:34 PM

In release 2716 I introduced also distance in reducing headlights effect at daytime, while increasing headlights brightness with respect to my previous release.

End of daytime (not yet twilight), long shadows, no headlight:
Attached Image: Nolights.jpg

End of daytime (not yet twilight), long shadows, headlight: the headlight is able to increase brightness of near shadowed terrain, without influencing unshadowed terrain:
Attached Image: Lights.jpg

Twilight, no headlight:
Attached Image: Nolights_twilight.jpg

Twilight, headlight: the headlight effect now arrives at longer (but not yet maximum) distance
Attached Image: Lights_twilight.jpg

Nighttime, headlight: effect as usual
Attached Image: Lights_night.jpg

#49 User is offline   markus_GE 

  • Executive Vice President
  • PipPipPipPipPipPipPipPipPip
  • Group: ET Admin Group
  • Posts: 4,862
  • Joined: 07-February 13
  • Gender:Male
  • Location:Leoben, Styria, Austria, Europe
  • Simulator:ORTS / MSTS
  • Country:

Posted 14 December 2014 - 12:48 PM

That looks awesome, Carlo :thumbdown3:

Cheers, Markus

#50 User is offline   That Genset Foamer 

  • Superintendant
  • Group: Status: Inactive
  • Posts: 1,459
  • Joined: 14-September 12
  • Gender:Male
  • Location:Somewhere on the ATSF 4th District
  • Simulator:OpenRails
  • Country:

Posted 14 December 2014 - 02:20 PM

That looks BEAUTIFUL! Also I like what kind of opportunities this could open up with lighting...

#51 User is offline   scottb613 

  • Executive Vice President
  • Group: Status: First Class
  • Posts: 3,187
  • Joined: 06-July 09
  • Gender:Male
  • Location:Downeast Maine (soon)
  • Simulator:ORTS
  • Country:

Posted 14 December 2014 - 02:30 PM

Hi Carlos,

Really nice work - just wondering - can you increase the lights effectiveness during heavy fog, rain, or snow ? That will save some entries in the ENG file...

Regards,
Scott

#52 User is offline   elvasleis 

  • Fireman
  • Group: Status: First Class
  • Posts: 236
  • Joined: 30-June 08
  • Gender:Male
  • Location:Dubbo
  • Country:

Posted 14 December 2014 - 11:34 PM

Hi,
The brightness of light being cast on the trees and ground from the head lights appears to have been cut back.
Looks good now.

Regards from a happy customer.

#53 User is offline   Csantucci 

  • Member, Board of Directors
  • Group: Posts: Elite Member
  • Posts: 7,450
  • Joined: 31-December 11
  • Gender:Male
  • Country:

Posted 14 December 2014 - 11:48 PM

Thank you all!
@ elvasleis: Yes, at daytime it is so, as in reality. When darkness advances, also the effect of the headlights increases.
@ Scott: I'll look at what could be done in case of disturbed weather conditions.

#54 User is offline   RTP 

  • Conductor
  • Group: Posts: Active Member
  • Posts: 254
  • Joined: 14-June 09
  • Gender:Male
  • Location:Barcelona
  • Simulator:Open Rails
  • Country:

Posted 15 December 2014 - 08:58 AM

Very good job about the lights.

But, spawned cars and some other objets do not shadow.

The shadow of the loco is lighter than the sadows of the buildings.

Regards.

Attached Image: Shadows.jpg

#55 User is offline   EricF 

  • Fireman
  • Group: Posts: Active Member
  • Posts: 217
  • Joined: 07-December 11
  • Gender:Male
  • Location:New England
  • Simulator:Open Rails / Sometimes MSTS
  • Country:

Posted 15 December 2014 - 04:00 PM

I appreciate all the work so far -- the lighting is looking much better now!

  • 5 Pages +
  • « First
  • 2
  • 3
  • 4
  • 5
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users