Elvas Tower: Headlights in OR - Elvas Tower

Jump to content

  • 7 Pages +
  • « First
  • 3
  • 4
  • 5
  • 6
  • 7
  • 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: Status: Elite Member
  • Posts: 7,025
  • 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 online   James Ross 

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

Posted 13 December 2014 - 08:55 AM

 Csantucci, 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: Status: Elite Member
  • Posts: 7,025
  • 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: Status: Elite Member
  • Posts: 7,025
  • 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 online   James Ross 

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

Posted 13 December 2014 - 02:01 PM

 Csantucci, 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: Status: Elite Member
  • Posts: 7,025
  • 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: Status: Elite Member
  • Posts: 7,025
  • 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: Status: Elite Member
  • Posts: 7,025
  • 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
  • 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...

  • 7 Pages +
  • « First
  • 3
  • 4
  • 5
  • 6
  • 7
  • 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