Improving lights

Discussion in 'Car Modding' started by jtbo, Jan 27, 2012.

  1. jtbo

    jtbo Registered

    Joined:
    Jan 12, 2012
    Messages:
    1,668
    Likes Received:
    48
    I started playing with headlights, I did put lights from Megane to rTrainer as I could not yet figure out how to add something to Megane that is in single player.

    This is what I came up with, mainly Attenuate and intensity need to be changed, range is good to change too, Pos and Dir need to be tailored to car which lights are installed. These have good visibility range of 250-300 meters, they go bit too wide for my liking, but I have not figured out how to get wide startoff so that it is not too wide and still has some realistic range. I have attempted that with Attenuate 1st parameter, but there are complications, using that and one needs to ramp up intensity, but when you get enough intensity there is not much of falloff, I'm sure these can be improved further, but I thought I post this now so others can get to play with them too. I have no quote or code buttons for some reason so code is now below here:

    Light=HeadlightL
    {
    Type=Spot Pos=(-0.62, 0.50, -1.10) Dir=(0.10, -0.23, -0.85) Range=(0.000000, 400.842000) Active=True Attenuate=(1.4, 0.005, 0.00000051) Hotspots=(10.0, 66.0) Falloff=(2.0) Intensity=(5.500000) Color=(199, 205, 220)
    }
    Light=HeadlightR
    {
    Type=Spot Pos=(0.62, 0.50, -1.10) Dir=(-0.10, -0.23, -0.85) Range=(0.000000, 400.842000) Active=True Attenuate=(1.4, 0.005, 0.00000051) Hotspots=(10.0, 66.0) Falloff=(2.0) Intensity=(5.500000) Color=(199, 205, 220)
    }

    Intention was to mimic full beam on my RL car, which has Xenon driving lights, hence colour being bluish white.

    Dir= 2nd parameter is also important as that adjusts if lights shoot to sky or to road, you can imagine rotating light unit to point more towards ground when setting more towards negative and also opposite is true.

    Hotspots= is something I have not fully figured out, but it does change size of lit area, also two numbers control how smoothly light fades to sides, original is 10, 60, setting 10, 66 made lit area bit wider. Both change size of lit area, imo and that original 1:6 ratio or near there seem to produce nice fading light towards edge of lit area, but if 1st parameter is set higher it is easy to loose that and get razor sharp edges of lit area, more testing needed to figure this fully out.

    Intensity is power of light, easy to make so bright that objects wash out to white and I don't even use HDR, this example setup has little wash out too.

    Attenuate 3rd parameter is one controlling how light gets lower level with distance, that and intensity are ones to get enough range to lights and still not washing out everything near.

    Experiment and post your findings here, so anyone making car for night racing or realism can make use of information.

    Oh and if anyone knows how to get these changes to Megane car, please speak up, I have even tried to get Megane into dev mode but so far no success.

    edit:
    I made bit of improvements, now there is low and high beam, but low beam is always on.
    Light=HeadlightL
    {
    Type=Spot Pos=(-0.72, 0.30, -1.70) Dir=(-0.01, -0.10, -0.85) Range=(0.000000, 600.842000) Active=False Attenuate=(2.3, 0.018, 0.00000001) Hotspots=(10.0, 34.0) Falloff=(1.6) Intensity=(15.500000) Color=(199, 205, 220)
    }
    Light=HeadlightR
    {
    Type=Spot Pos=(0.72, 0.30, -1.70) Dir=(0.01, -0.10, -0.85) Range=(0.000000, 600.842000) Active=False Attenuate=(2.3, 0.018, 0.00000001) Hotspots=(10.0, 34.0) Falloff=(1.6) Intensity=(15.500000) Color=(199, 205, 220)
    }
    Light=HeadLightL1
    {
    Type=Spot Pos=(-0.62, 0.20, -1.70) Dir=(0.00, -0.10, -0.85) Range=(0.000000, 45.842000) Active=True Attenuate=(0.1, 0.01, 0.001) Hotspots=(10.0, 80.0) Falloff=(0.75) Intensity=(2.000000) Color=(199, 205, 220)
    }
    Light=HeadLightR1
    {
    Type=Spot Pos=(0.62, 0.20, -1.70) Dir=(0.00, -0.10, -0.85) Range=(0.000000, 55.842000) Active=True Attenuate=(0.1, 0.01, 0.0006) Hotspots=(10.0, 80.0) Falloff=(0.75) Intensity=(2.000000) Color=(199, 205, 220)
    }

    There can be better ways to do same effect, but I have to test more to find if such exists, however at least now it is kind of ok. Using those additional lights was required to get shape of light to be better, with that I could make high beam enough narrow and still have wide area of light near the car. This is made for Megane, works with that one quite ok.

    http://jtbo.pp.fi/images/rfactor/GRAB_025.JPG
     
    Last edited by a moderator: Jan 28, 2012
  2. Goat

    Goat Registered

    Joined:
    Nov 3, 2011
    Messages:
    90
    Likes Received:
    0
    Very helpfull,

    Thank you!!
     
  3. jtbo

    jtbo Registered

    Joined:
    Jan 12, 2012
    Messages:
    1,668
    Likes Received:
    48
    You are welcome, hopefully when someone finds out more it will get updated here so we can have good guide to how to build realistic lights.

    I have been playing a bit with Hotspots= values, I'm not quite sure yet, but I think those are angles in degrees, first being bright cone of light and second max angle that is lit. However I'm not perfectly sure if such is the case, there can be something else at play there too, values could be not degrees but something else etc, but so far I'm leaning towards them being degrees. Only thing bothering me is that first value seem to cause quite huge changes to how light falls off, but as changing cone size it is often needed to adjust where light is pointed to, so Dir= 2nd parameter adjusts up and down direction and it is also needed to adjust.

    Cars made for right side traffic also have often dipped/lowbeam set up so that right side of road is lit further than left side of road, I have tried to make this happen so that I have set range to different values left and right, also I have used Dir= 1st parameter to point lights bit right, I need to experiment more with this, but it is possible to make quite ok effect.

    Maybe it is possible to set lights on and off via upgrades and then use H key (or where mapped) for low and high beam, that is what I have been doing now as I set up four headlights, two is set active= true and two is set active=false, that is full beam that is switched active by H key.

    When making tracks there is something different from rF1, lights are not visible or are not moving with the car, that has been case at least with one addon track, so good to test tracks at night too when making tracks.
     
  4. taufikp

    taufikp Registered

    Joined:
    Nov 14, 2010
    Messages:
    609
    Likes Received:
    16
    Nice! Subscribed to this thread! :)
     
  5. nickbalti

    nickbalti Registered

    Joined:
    Jan 12, 2012
    Messages:
    383
    Likes Received:
    8
    Mind me asking where this file is? I want to add the code :)
     
  6. Jamdk

    Jamdk Registered

    Joined:
    Apr 5, 2012
    Messages:
    3
    Likes Received:
    0
    Same question from me..witch file to be edited. :)
     
  7. taufikp

    taufikp Registered

    Joined:
    Nov 14, 2010
    Messages:
    609
    Likes Received:
    16
    IMO, you need to open the camera file of each vehicle. Very easy to do in rFactor1, but it's a PITA in rFactor2 :(
     
  8. Jamdk

    Jamdk Registered

    Joined:
    Apr 5, 2012
    Messages:
    3
    Likes Received:
    0
    Can you explain me the name of the MAS file(Meganes2009) and the name of the local file in the MAS file i have to add the light lines ?
    I have tried to add the light lines in the file called M2009_CAM.CAM without any result.

    Best reguards
    Jamdk
     
  9. Goat

    Goat Registered

    Joined:
    Nov 3, 2011
    Messages:
    90
    Likes Received:
    0
    The lines of code are in the *.gen file
    Should be in the lights pr headlights section
     
  10. Jamdk

    Jamdk Registered

    Joined:
    Apr 5, 2012
    Messages:
    3
    Likes Received:
    0
    Found it :D Thanks
     
  11. taufikp

    taufikp Registered

    Joined:
    Nov 14, 2010
    Messages:
    609
    Likes Received:
    16
    By the way, here's the sample of jtbo's code above:

    [​IMG]
     

Share This Page