Suggestion for ambient lighting

Discussion in 'Wish Lists' started by K Szczech, Feb 25, 2015.

  1. K Szczech

    K Szczech Registered

    Joined:
    Oct 5, 2010
    Messages:
    1,720
    Likes Received:
    45
    Since there are some updates to lighting and sky coming, I'd like to make a few suggestions:
    - general feedback on sky shading and brightness, especially past sunset
    - some thoughts on horizon shading coming from my experiences
    - suggestion for ambient lighting formulas that can help get a bit further with lighting immersion

    Since sky shading and ambient lighting are connected, I'm putting all of it in one post :)

    1. Sky
    Common mistake made by many games is to make world look darker during sunsets. It may actually be darker, but our eyes will adapt, and so should HDR.
    There are many sunset time lapse videos out there, but here's one of my very favorites: LINK
    It's a good reference for three reasons:
    - first of all, camera is not facing the Sun, so it does not suddenly change exposure. That's why this video reminds me what I see in real life more than other video.
    - done from some altitude, so giving good overview of what's happening to ground lighting as well
    - it just looks like what I'm used to in real life and yay! There's a nice ball down there that serves as some sort of rel-life light probe :)

    Why I'm posting this - note that:
    - ambient lighting clearly has light blue tone
    - sky and world remains bright past sunset - it goes dark a bit later. Even if absolute intensity of light is way lower than during daytime, our eyes and HDR implementations will adapt and we will see everything clearly after sunset - something many games get wrong
    - pause it at 0:25 - the moment when direct sunlight is gone. That's what I want to see. Also note the importance of directional ambient (for lack of GI :) )


    2. Horizon
    Second suggestion is about scattering near horizon. Many people know Rayleigh formulas, but the key is to understand the chain of events. You can't just apply Rayleigh formula in shader - you have to take two things into account - you're close to the ground and have much more optical depth near horizon.

    What does this mean to photons? Plenty of "scattering iterations". More than single instance of Rayleigh formula can represent. That's why horizons often look bad in games that have sky done "by the book".
    The difference is that close to the ground you have to take scattering direction into account. Photons that get outscattered sideways have a good chance of being inscattered again in low, thick layers of atmosphere - hence the red bar effect on horizon. The ones that get outscattered up will travel through air that has less optical depth from our point of view, so we're less likely to see them inscattered and travel our way again. And photons that get outscattered downwards hit the ground and are never inscattered again. Also, thicker optical depth near horizon means photons emitted from ground have higher chance of being inscattered towards us.

    I'd love to see that taken into account. An example here:

    [​IMG]


    3. Ambient lighting
    My third suggestion is about ambient lighting. We don't have GI in rF2, but we can follow a certain simple schema when calculating ambient lighting. Here's what I'm proposing:

    - sun_light - calculated from sun luminance and outscattering
    - sky_light - based on average sky brightness
    ^^^ use above two for shading clouds

    - cloud_light - calculate by approximating average cloud color calculated by cloud shading

    - incoming_light - sky_light * inverse_cloud_cover + cloud_light * cloud_cover - ambient lighting coming from sky to ground
    - bounced_light - bounce_function( incoming_light + sun_light ) - bounce function slightly varies bounced light based on area character (flat terrain vs urban areas)
    ^^^ use incoming light and bounced light to determine ambient lighting for scene.

    Better yet, weight them for more direction sensitive ambient.
    Or go even further - introduce additional sky_light_2 variable for average sky brightness near Sun. If you weight between sky_light and sky_light_2 when calculating incoming_light, you will get even more directional ambient.



    Actually I like the approach taken by some modern game engines, like Reset:

    [​IMG]

    They use cubemaps for ambient lighting. After all, when done correctly they're light probes. You can either:
    - use cubemap for image based lighting
    - use cubemap to calculate a few vectors for directional ambient lighting
    - use cubemap to calculate average ambient light and use it with classic, flat ambient model

    Current cubemap system in rF2 is insufficient for that, but it may be an argument for working on it in the future. Right now I just wanted to present a simpler concept for ambient lighting :)

    I hope this helps, but in the end, you're the guys shaping this product.
     
    Last edited by a moderator: Feb 25, 2015
  2. Fabio Pittol

    Fabio Pittol Registered

    Joined:
    Oct 4, 2010
    Messages:
    274
    Likes Received:
    71
    I came here just to read and learn! lol
     
  3. Prodigy

    Prodigy Registered

    Joined:
    Nov 2, 2012
    Messages:
    949
    Likes Received:
    64
    Me too!

    Even though I'm not a modeler by any means, I like K's postings, he knows his stuff and it's always interesting to read.

    Now if only someone from Devs could answer if something from his suggestions would be available to implement and how much time consuming would it be.
     
  4. K Szczech

    K Szczech Registered

    Joined:
    Oct 5, 2010
    Messages:
    1,720
    Likes Received:
    45
    First one is just a matter of settings. When rF2 was first released I wanted to make a realistic HDR profile, but once I discovered ambient light color is locked to grey I abandoned that idea.


    Second is something to consider while working on sky shaders. You can know all the formulas, but without sufficient understanding of the domain you will only be scratching your head why results are not what you would expect. A few years ago I thought I will get a nice sky once I get all the formulas right, but I didn't. I left my sky shader alone and let the thoughts circle around my head for a few months, then I finally understood just how much further I would have to get that shader to even get close to reality :)

    I hope I can save ISI some time by pointing them in the right direction, because I see their sky shader taking the same road as my early implementation.


    Third one is not very complex - just a few formulas to run each frame to approximate intensity and color of ambient lighting.
    If you pay attention to real world you can notice many interesting things - how sky seems relatively brighter than landscape when covered by thin but solid cloud cover, how much quicker it gets dark past sunset during overcast, how blue is world shortly past sunset (especially noticeable when leaving a building with interior lighting).


    Oh, I guess I have 4th suggestion :)


    4. Sun occlusion
    If you calculate your sun occlusion locally, at some point or area in the sky, but apply it globally, then it makes very little sense - entire world gets bright and dark for no apparent reason. Very confusing for the driver. Either do actual cloud shadows or calculate sun occlusion globally (by averaging cloud cover), not locally.
     
  5. Je suis Luis

    Je suis Luis Banned

    Joined:
    Jan 21, 2015
    Messages:
    328
    Likes Received:
    0
    Why should hdr do my eyes work?
     
  6. K Szczech

    K Szczech Registered

    Joined:
    Oct 5, 2010
    Messages:
    1,720
    Likes Received:
    45
    For two reasons:
    - your graphics card is not capable of outputting the same light intensity range as real life, so there's nothing your eyes would adapt to - you're just looking at the same monitor with more less the same brightness.
    - even if it were capable of it, your monitor may be placed in a bright room and if pic goes dark, your eyes would not adapt to it, but to the room instead

    HDR is there to simulate our eyes reaction to real world lighting, so game can produce the imae we would see and put it on your display monitor.
     
  7. Some1

    Some1 Registered

    Joined:
    Aug 23, 2012
    Messages:
    176
    Likes Received:
    14
    What about Oculus Rift and similar things?
     
  8. Some1

    Some1 Registered

    Joined:
    Aug 23, 2012
    Messages:
    176
    Likes Received:
    14
    I personally feel that ISI would be better off with a decent 3rd party graphics/game engine (UnrealEngine, Reset etc) while concentrating on physics rather than trying to implement modern graphics features in the current engine. If only there was enough moneyz :)
     
  9. speed1

    speed1 Banned

    Joined:
    Jul 26, 2012
    Messages:
    1,858
    Likes Received:
    0
    Give the OP what he needs and let him do, or use founding for outsourced engine parts. I think a private conversation with the responsible would have more success.
     
  10. Fabio Pittol

    Fabio Pittol Registered

    Joined:
    Oct 4, 2010
    Messages:
    274
    Likes Received:
    71
    The engines itself are not that expensive, but porting everything would be. I honestly think that this ship has sailed. :(

    Would be nice if at least they hired some part-time staff to overhaul those "left behind" portions of the engine. And let they own gurus focusing on what they do best, car physics.
     
  11. K Szczech

    K Szczech Registered

    Joined:
    Oct 5, 2010
    Messages:
    1,720
    Likes Received:
    45
    Oculus is connected to the same graphics card. The one that displays your desktop. It cannot produce the range of light you encounter in real world because it only outputs RGB values from 0 to 255.
    Only 256 different brightness values is just enough to show decent picture in one light range.

    Even if you would have "HDR" display, you still don't have "HDR" output from graphics.


    @Fabio - sounds reasonable, but there is always that issue with us, developers, that we enjoy our work and don't like just buying the code :)
     
  12. Satangoss

    Satangoss Registered

    Joined:
    Jun 2, 2011
    Messages:
    1,123
    Likes Received:
    7
    I've never seen a high-end GFX engine combined with good physics.

    If you ask me Outerra (http://www.outerra.com/) is the closest one but even so the vehicles physics are quite silly.
     
  13. K Szczech

    K Szczech Registered

    Joined:
    Oct 5, 2010
    Messages:
    1,720
    Likes Received:
    45
    Let's not go completely off topic, shall we? :)

    This thread is about particular changes that actually can be introduced into rF2 with reasonable effort.
     
  14. blakboks

    blakboks Registered

    Joined:
    Oct 20, 2010
    Messages:
    843
    Likes Received:
    30
    Brightside Technologies (since bought out by Dolby Laboratories) had a working HDR display 12 years ago at SIGGRAPH--they had to use dual DVI in order to get a 16 bpc signal to the display, though, using their own drivers. Most realistic display I've ever seen. It was by far the closest thing to 'reality' I've seen from a display. The new curved OLED screens being a somewhat close second, though, even though they're still operating at 8 bpc.

    An HDR HMD sounds like a very interesting proposition, though. Hopefully graphics card manufacturers will find the ability to get on board with outputting > 8bpc color, and HMD manufacturers will be able to tone down the darks (which seems more likely with OLED displays).
     
  15. Alejandro1

    Alejandro1 Registered

    Joined:
    Aug 17, 2014
    Messages:
    75
    Likes Received:
    5
    "Since there are some updates to lighting and sky coming,"
    Can you link the discussion about these future updates regarding lighting and sky?
     
  16. Fabio Pittol

    Fabio Pittol Registered

    Joined:
    Oct 4, 2010
    Messages:
    274
    Likes Received:
    71
  17. Alejandro1

    Alejandro1 Registered

    Joined:
    Aug 17, 2014
    Messages:
    75
    Likes Received:
    5
    I'm sure the developers know all about these kind of things - because the devs are badass and these things are extremely popular anyways.
    http://www.gdcvault.com/play/1018086/Photorealism-Through-the-Eyes-of

    It's just a matter of time until rfactor 3.

    About the white ambient light color, the developer already answered it. The bluish shadows are due to incorrect white balance.
    But because they are beautiful, game developers choose to keep them.
    Photorrealism... through the eyes of an artist, as Kojima Productions says. It is not correct; its beautiful.
     
  18. Je suis Luis

    Je suis Luis Banned

    Joined:
    Jan 21, 2015
    Messages:
    328
    Likes Received:
    0
    Interesting. I will assume if i´m in dark room (if my gfx was capable of outputting the same light intensity range as in real life, as you said) then my eyes could adapt making hdr not essencial?

    Can i assume HDR is a type of "canned effect" graphically speaking?

    Sorry for the OT and if the questions are not appropriated. Also for my english too.
     
  19. blakboks

    blakboks Registered

    Joined:
    Oct 20, 2010
    Messages:
    843
    Likes Received:
    30
    Being a bit pedantic here...but it's not 'just' a matter of your graphics card being capable of outputting same light intensity range. Your display also needs to be able to do so (which is kind of unrealistic--imagine a display that can get as bright as the sun or a welding arc).

    Sort of. It's a little bit of an over-simplification, but one way to think about HDR is like 'exposure' of a photograph. So, it's as much a "canned effect" as dialing-in exposure is on a camera. The whole point of HDR is to take a large range of light intensity (a High Dynamic Range, if you will), and try to get it to fit into a range of light intensities that our displays can handle.
     
  20. Je suis Luis

    Je suis Luis Banned

    Joined:
    Jan 21, 2015
    Messages:
    328
    Likes Received:
    0
    Thanks. It´s just curiosity, i have no knowledge on that matter but can understand what you are saying and the analogies.

    :)
     

Share This Page