Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Chingwa's Guide to Lighting and Post Effects

Discussion in 'General Discussion' started by chingwa, May 22, 2017.

  1. frosted

    frosted

    Joined:
    Jan 17, 2014
    Posts:
    4,044
    I would +1 this a thousand times if I could.
     
    andreiagmu, Ony and neoshaman like this.
  2. Billy4184

    Billy4184

    Joined:
    Jul 7, 2014
    Posts:
    5,984
    I don't necessarily agree with this - I mean sure chromatic aberration is ridiculous, but I don't think that these things have to fight eachother at all.

    You say that the artistic reality is always trying to fight realism, but why should it? There are many attributes of realism that are helpful to artistry - in fact artistry is often a case of taking some aspect of reality and exaggerating it for effect. I would say that the main thing here would be to simply make sure that the information on the screen is restricted enough for the player to be comfortable. In that sense I like the picture I posted because the environmental information, while high fidelity, is much more simple than it would be if it was an actual place. And especially the colors and even tones are restricted enough that anything that was placed in it would immediately get attention. It would be easy enough for the game to direct the player's attention.

    If you look at this:


    It's clear that even though it is quite realistic, almost anything that was added would immediately catch the attention of the player - whether it was a house, a person, a motif of some kind, whatever - just by adding a hint of unusual color or contrast.
     
    chingwa likes this.
  3. neoshaman

    neoshaman

    Joined:
    Feb 11, 2011
    Posts:
    6,472
    Yes, good image is a good image, always. This game is able to make most of this lighting for the impact they are going for.

    What I'm criticism is the discourse around lighting in this thread, that sometimes veer too much in what I think is cargo cult of lighting. There was once an initiative in indie movie called dogme 95 manifesto (https://en.wikipedia.org/wiki/Dogme_95), which was all about shooting using ONLY real light condition, to reduce cost and set a more authentic experience, a rules they broke so fast it became irrelevant. The thing is that movie lighting set up often look like this:

    They are real but nothing natural, the result is much carved such intentionally, very shoot by shoot, that you so can't decently reproduce it, using only natural bounced lights and other. Generally in game, while people find way to have good lighting, they also don't have the heavy cinematic light that give movie this authenticity, that don't actually exist, maybe it's time to parent entire light set up to camera to get cinematic lighting?

    So when I say fight, I say that lighting works with a lot of band aid to look good inside the scene. And that's not even considering post production where more than filters can happen. This translate too in CG because it turns out a lot of early CG avoided Radiosity (until the last monster inc) all together, it was too expensive period, no real global illumination, it was all by hand, so the first toy story WAS artistic driven fake global illumination (just a lot of hand placed light).
    https://www.theverge.com/2013/6/21/...d-the-way-light-works-for-monsters-university Using radiosity (ie GI) was controversial. Did you know it's common practice, in CG movies, to have 5 lights that interact with nothing but the eyes?

    And that's something you see in all AAA game lighting talk, they spend time having a great lighting setup but with a lot of hand made band aid to make it work (placing visual blocker in crysis 3, hierarchy of light with decrease lumen and increase scattering for mirror edge 2, etc ...). Game DO struggle to have the expressive range of movie IN gameplay (cinematic is fine they cheat like movie just good lol).

    Regarding Chromatic Aberration, I have nothing against it, but a lot of time it's really just there because it's an effect of lenses, not to make an artistic statement or make the image look better, it's just because they are trying to match a reference of reality given by a camera lens. It was used as an example of reality that only exist to cover a truth. I'm also deeply myopic, I haven't had my glass prescription renewed, because real life chromatic aberration of my lenses was messing with color vision lol, BUT I don't mind it in game lol.

    What I'm just saying, is that it's great to try to match real world reference, but art direction will always trump the algorithm (you can make it pcg though ROFL). Art direction don't mean cheating necessarily, but it makes you take the limitation and make them shine, hence why ryse with and without PBR are barely different, PBR just made it they didn't have to handmade the material set up EVERYTIME they changed the lighting (to make the specular match reference) because energy conservation did that for them.

    The only reason CG have looked plastic so long, it was because we didn't had the knowledge to art direct the lighting correctly (ie toning down the specular that were too hot and add subtle fresnel everywhere) OR it was too expensive to go through all materials all the time, to get the right data out. PBR is a quality of life improvement over lighting first, by taking care of those adjustment (which you can bend just fine to get desirable effect).

    So fighting is maybe a strong word, I just demonstrated with every example how they coexist (but they did fight, like in that pixar example, and literally), but the thing is that focusing too much on one will lead to losing on the other, and just make it harder overall to achieve good result. Even when they don't fight, there is still trade off to consent!

    Hope that's helpful, I have been holding that RFOL


    Bonus round for practical lighting, even though it's not realist I think it something that light be helpful when you do a game:
    http://www.gdcvault.com/play/1014362/Cinematic-Character-Lighting-in-STAR (slide)
    http://www.gdcvault.com/play/1014360/Cinematic-Character-Lighting-in-STAR (video)
    It shows, in the middle of the talk, how they transform the lighting set up, by moving light, to get better automatic lighting during cinematics, that still looks like the gameplay light, yet serve the scene. It's not natural but look natural! And it's PGC art direction, I like PGC if you can't tell ROFL
     
    Last edited: May 25, 2017
    andreiagmu, Ony, TeagansDad and 3 others like this.
  4. Billy4184

    Billy4184

    Joined:
    Jul 7, 2014
    Posts:
    5,984
    Yeah there's no doubt that cinematic realism usually involves a lot of handiwork, and sometimes that handiwork involves covering up things that are realistic but undesirable. However I think that not only are games not quite the same, in that you don't always want every shot to be a hero shot covered with god rays and blooming specular highlights, but also in games there's an opportunity to dictate carefully from the beginning how you will set up the environment in a way that is very realistic but also very comfortable visually. I think this is something that the game I showed achieved.

    If you compare two scens like this:




    Although they both appear quite realistic, one is obviously much better suited for a game environment than the other, at least to me - because the environment has been reduced to a simpler expression of reality in a way that doesn't make it appear any less 'real'.

    PS Although I must admit, there are some pics from that game that to me are way too noisy to be comfortable.
     
    OCASM likes this.
  5. neoshaman

    neoshaman

    Joined:
    Feb 11, 2011
    Posts:
    6,472
    Hey come on! That's not what cinematic or movie are for, a movie isn't made of only hero shoot, there is much more to movie lighting that god ray and excessive bloom, you could have pick a better example. In that dogme 95 movie they were trying to do, they covered a windows with a cloth t have softer diffuse light to get the right emotion! That's no hero shoot!

    And I had cut one part because I was digressing and it wasn't brought up enough yet (kinda): architecture. A big part of architecture is to sculpt light for places using natural lighting and carefully placed artificial light. That's the whole archviz fetish in fact but it doesn't stop at building. Movie tap on that with set design but going a bit further in the range of expressive impact. Looking at theme park is also a great idea, they been exploring that too.

    Game tap into this to set up great places that are in between set design and architecture to live in. Where circulation is carefully doctored akin to theme park to have sight view and reveal. I'm just saying that there is always a great deal of artificiality in what we call real light, just matching references is not enough. Set design carefully choose material and their quality to have desired effects. Wood won't just be wood, it would be wood that will be transform to express "authentic" woodness, But only one that match the intent of the scene. My point is that everything is heavily doctored to amplify impression, you won't rely on simple light alone.

    I mean just look at the image you have shared, look at the plant just in front of the water, some plant are oddly distinctive and don't seem to appear anywhere else in the back, even though they aren't necessarily water base, Worse it's too obvious that there is thin strip of distinct shape that isn't scattered organically, because in truth it seem they are there because it's a sight view, you go through the bridge (ie we know where the player is where he is looking) and they needed something to break the grass line to make it less bland. It jumped at me when you shared the image. That's art direction. Look at how the house have better color contrast with their environment than the viking village, that's art direction, there is a lot of choice made before lighting start make its own magic.

    I'm sure (maybe?) the color of the tree in the second image has been tweak somewhat to get better silhouetting rather than purely realistic tree, I say that because tree that are more directly in the light aren't any lighter than those deep in the forest. Which mean they tweaked it to be closer to a painting reality than just a natural light reality. And who know, maybe they place a volume inside the forest to get this deep shadow effect within it to make emphasis and contrast of that shoot?

    Juts because it's not always inside a frame, it mean you don't cheat with the light, just because atmosphere aren't bombastic mean you don't cheat to have subdue emotion. Big lighting set up aren't only for well light scene (as in there is plenty of light), it's for any scene, even dark scene.

     
    Ony likes this.
  6. chingwa

    chingwa

    Joined:
    Dec 4, 2009
    Posts:
    3,784
    @frosted I just wanted to address this from yesterday because I don't really agree, and I think we don't have the same definitions to describe what's going on in the image.

    On a technical level the image is not blown out, it is actually slightly underexposed still, meaning the brightest areas still have a little more room that they could be brightened before they actually hit pure white.

    This is shown on the histogram. You can see the space on the right side which indicates that the image is indeed slightly underexposed. Blowout usually refers to the brights (or the darks) going beyond the displayable value range so that brighter areas in the image will be unnecessarily white. (or dark areas unnecessarily black)



    But technical aspects aside, the overall effect in the image is of too much lighting... but this is just visual perception because there isn't any relief for your eye... values are too same-ish overall. Even though technically the image is slightlty underexposed, it doesn't matter visually.

    No, I didn't expand the brightness range, or touch the white balance. I only lowered the color/value on the dirt and grass sections, but this did not change the overall value range in the image. It just rebalances it visually, and gives your eye some more context to understand the value range as it exists already.
     
    TeagansDad, Martin_H and neoshaman like this.
  7. chingwa

    chingwa

    Joined:
    Dec 4, 2009
    Posts:
    3,784
    @frosted I'm not picking on you, honest! but again I don't agree. Witcher3 is deservedly lauded as a game and for graphics, but I was not particularly impressed by the lighting or color, I hate to say. Much of the accolades it gets for graphics is down to consistency in visual theme, world building, and attention to detail... not so much technical brilliance on the graphics side. Don't even get me started about their water! :D

    There is no magic in the Witcher3 screenshot that @ShadowK posted. In fact, since you read my tutorial you should have the techniques you need to get that low light performance in your own games. It really is as simple as starting with a good technical base so that you have a proper value range as a starting point, and then protecting that value range as you make your visual and post-process choices. Keep your darker values from "blowing out" too much and you will be able to get the same type of details in that screenshot.

    Also, their bloom doesn't maintain detail, they don't use a magic bloom technique. I assume it's as simple as a depth oriented bloom... in which case all you need to do is multiply the bloom value with the depth buffer clamped to a certain range. Easy enough to do in Unity too!

    Witcher3's real brilliance is in implementation, not technique.
     
    TeagansDad, zenGarden and Martin_H like this.
  8. Billy4184

    Billy4184

    Joined:
    Jul 7, 2014
    Posts:
    5,984
    Yeah that's the same impression I get. I also can appreciate the detail of Witcher games, and the very strong style as well, but I'm not incredibly impressed by the presentation a lot of the time - although sometimes it all pulls together and looks fantastic.
     
  9. chingwa

    chingwa

    Joined:
    Dec 4, 2009
    Posts:
    3,784
    @Billy4184 I've been following Kingdom Come from the beginning. It might be the game I'm most excited about for the past few years. It's definitely beautiful. They certainly have some interesting tech going on, some kind of dynamic GI for sure as I remember watching a video where they spoke of that specifically.

    But the below image has no apparent use for GI, and very little direct lighting as well. The real star is the texture work. Almost all of the lighting in this scene is just an interaction between their general sky ambient and their excellent excellent texture work.
     
    frosted and Billy4184 like this.
  10. Billy4184

    Billy4184

    Joined:
    Jul 7, 2014
    Posts:
    5,984
    It's using some kind of SVOGI from cryengine. There are a few comparison videos (with the GI on/off) that I came across.


    You're definitely right that it would be a good-looking game without GI, but what makes it look so insanely good is definitely the GI imo, based on the comparisons.
     
    UnityLighting, chingwa and Martin_H like this.
  11. zenGarden

    zenGarden

    Joined:
    Mar 30, 2013
    Posts:
    4,538
    I wander why Unity does not make reasearch and bring SVOTI ? It would benefit many people making desktop games, and that does not want to spend days baking a level each time.
     
    chingwa likes this.
  12. chingwa

    chingwa

    Joined:
    Dec 4, 2009
    Posts:
    3,784
    It would be awesome to have a built in solution got realtime GI... but they sure have a long list of projects that should have more focus first :D. To be fair, Unity has come a looong way over the course of Unity 5 and there have been some big technical and graphical improvements. I just wish I saw more visible effort put into addressing some long standing pitfalls of the engine over their 'SERVICES' which seems to get so much love from the dev side. Can't blame them though if they see services as being where the money is. We all gotta eat.
     
    daisySa and Billy4184 like this.
  13. frosted

    frosted

    Joined:
    Jan 17, 2014
    Posts:
    4,044
    The definition I am using for blowout is when far too much of the color for a scene is compressed into too small of a range.
    upload_2017-5-25_8-59-11.png
    chrome_2017-05-25_08-59-39.png
    The vast, vast majority of the color is compressed into a very small area.

    When you adjusted it:
    upload_2017-5-25_9-6-34.png gimp-2.8_2017-05-25_09-06-49.png
    You redistributed the range and smoothed it out. Not everything is as compacted. There's a much wider range here than in the original, notice the smoother falloff from the peak.

    upload_2017-5-25_9-11-12.png
    Maybe this is a bit easier to see - in the original ^^ are the colors used. Everything is a slight shade between tan and yellow/green.

    Maybe I am misusing "blowout" since this isn't just shading everything white, but a narrow range of color is still dominating too much of the image (usually because of post processing). The colors are being pushed too far to an extreme, which ends up narrowing the range of color.

    I don't think I actually disagree with you, I think my vocabulary may be a bit "profane" (hattip @neoshaman). Your edit is fixing the problem both of us are looking at, even if I'm using the wrong words to describe it.
     
    Last edited: May 25, 2017
  14. OCASM

    OCASM

    Joined:
    Jan 12, 2011
    Posts:
    326
    Because it's extremely expensive, doesn't look as good as baked and would probably be used only in a handful of games.
     
    Martin_H and frosted like this.
  15. zenGarden

    zenGarden

    Joined:
    Mar 30, 2013
    Posts:
    4,538
    It runs great on cheap 3D cards like GTX 960, if performance is an issue you can always lower settings.
    The point is many people want some full real time GI option and Unity could do it.
     
  16. Martin_H

    Martin_H

    Joined:
    Jul 11, 2015
    Posts:
    4,433
    Afaik "blown out highlights" refers to clipping:
    https://en.wikipedia.org/wiki/Clipping_(photography)

    Histograms are useful to check whether you're clipping or not (if there even is any doubt just looking at the picture). Whether clipping actually is an issue for a specific image is another topic. I think over-reliance on histograms to judge image-quality will lead to over-generalization and dogmatic decision-making. Also histograms completely ignore all the perceptual quirks that come from the visual context, like this one:



    https://en.wikipedia.org/wiki/Checker_shadow_illusion
     
    iamthwee, chingwa, neoshaman and 2 others like this.
  17. frosted

    frosted

    Joined:
    Jan 17, 2014
    Posts:
    4,044
    Let's try to get past the definitions for a second.


    The green in the grass is being washed out, and the brown in the building is being
    washed out. Everything is being tinted yellow.


    Is this an example of balanced color?

    I would say no, because the Red and Green are being remapped to Yellow. I consider that a problem.

    It's hard to say why this happened, either the intensity of a yellow light was cranked up and yellow is being multiplied onto the albedo too much, or the tonemapping is crushing the color range between green and red.

    Either way, this is almost certainly a result of the "quest for vivid color", resulting in color ranges being compressed.

    This may not be "clipping" or "blowout" but it's the same concept:
    - too many colors are being mapped to the same, or very similar value, with the result being a loss of color data.
     
    Last edited: May 26, 2017
  18. Martin_H

    Martin_H

    Joined:
    Jul 11, 2015
    Posts:
    4,433
    I don't think it looks right either, but I can't tell you what caused it, I'd need to play with the scene. How old is this screenshot, did the post stack we have now even exist back then? Is it maybe a tonemapping issue? I don't know. Unless you can download the scene to see what happened and try out what fixes it, I wouldn't get too hung up on that image. I'm certain Unity can produce far better nowadays.
     
  19. Billy4184

    Billy4184

    Joined:
    Jul 7, 2014
    Posts:
    5,984
    EDIT: can't link the images it seems, but anyway there are a few at the bottom of the blog post linked below, including the sponza scene.

    @Martin_H the blog post these images are from is dated late last year.
     
    Martin_H likes this.
  20. Adam-Bailey

    Adam-Bailey

    Joined:
    Feb 17, 2015
    Posts:
    232
    IIRC, that image is from a tutorial about how to optimise Enlighten baking times but doesn't do any artistic stuff beyond that.
     
    Martin_H likes this.
  21. zenGarden

    zenGarden

    Joined:
    Mar 30, 2013
    Posts:
    4,538
    @frosted seems to be lost on the artistic side of things lol
     
  22. frosted

    frosted

    Joined:
    Jan 17, 2014
    Posts:
    4,044
    It is my unicorn quest. ;)

    To be clear, I'm not saying "Unity sucks and destroys color" - I'm just trying to figure out and define what "good" color is or "good light" is. In order to figure out what good color is - it helps to properly determine bad color.

    Not trying to nitpick, honest, just trying to figure out the different parts.

    In some of my earlier examples, I cranked up color values and bounce color values to try to make "vivid color" also, and ran into the same kinds of problems: I ended up tinting all the colors too much. Everything turned red instead of yellow.



    Although @chingwa's example isn't super fancy, the balance between colors is very good.

    Green = Green.
    Blue = Blue.
    Red = Red.

    Each color is distinct and clear.
     
    Last edited: May 26, 2017
  23. Martin_H

    Martin_H

    Joined:
    Jul 11, 2015
    Posts:
    4,433
    Looking at the sponza scene and double checking with my scene, I think they might have just cranked the sunlight up too high and forgot to switch hdr on. Both seem to contribute to make colors converge towards white in this washed out way, when intense light hits them.
     
    frosted likes this.
  24. zenGarden

    zenGarden

    Joined:
    Mar 30, 2013
    Posts:
    4,538
    There is AAA games abusing HDR and vivid colors, and people like the graphics despite it is no more natural or super realistic colors


    Unity can do ant graphic style, you have post process effects , and as your concern is coloring you can use LUT, it will dragstically change the tone of your level.
    Perhaps you should it the way you like and show us your work , instead of pointing random screenshots.
     
  25. frosted

    frosted

    Joined:
    Jan 17, 2014
    Posts:
    4,044
    I would go further and say that this is actually kind of worrisome.

    (from the progressive lightmap Unity blog)

    This should not be in examples of new fancy lighting system...
     
    AcidArrow likes this.
  26. neoshaman

    neoshaman

    Joined:
    Feb 11, 2011
    Posts:
    6,472
    Too many technical people trying to solve a visual problem, as long as the math is correct, the artist will figure out ... but only when technically minded artist will do a pass to translate the FRAK into something that actually make sense :p
     
    Ony, TeagansDad, chingwa and 3 others like this.
  27. Tzan

    Tzan

    Joined:
    Apr 5, 2009
    Posts:
    733
    I started following along with my own project I'm thinking about converting to linear.
    When I set the skybox it contributed zero light to the scene. The back side of the models is pure black.
    Unity 5.5.2 how is this even a bug that gets by Unity testing??

    I'll check your project for the script your wrote.
     
  28. neoshaman

    neoshaman

    Joined:
    Feb 11, 2011
    Posts:
    6,472
    It's pure black because the skybox provided the ambient light, without light, there is only darkness.
     
  29. Tzan

    Tzan

    Joined:
    Apr 5, 2009
    Posts:
    733
    Yeah but the skybox is on, set to the default box.
     
  30. Adam-Bailey

    Adam-Bailey

    Joined:
    Feb 17, 2015
    Posts:
    232
    Is this an interior environment?
     
  31. Tzan

    Tzan

    Joined:
    Apr 5, 2009
    Posts:
    733
    No, its a landscape area.
    One thing it could be is the shader maybe.
    I'm doing vertex colors, Unity refuses to provide a proper shader so we need to rely upon another user to make one.
    Frequently they are not perfect. I need to review Chingwa's project files.
     
  32. chingwa

    chingwa

    Joined:
    Dec 4, 2009
    Posts:
    3,784
    Indeed, you're seeing black shadows because Unity is not applying ambient lighting to the environment properly. I'll attach the script I made, which should save you some trouble. I think it must be a Unity bug, perhaps initiated by something that happened in the original project that I downloaded before making my edits. Just attach the below code to your camera (or anywhere else in your project).

    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4.  
    5. public class UpdateLighting : MonoBehaviour {
    6.  
    7.     public float updateTime = 0.25f;
    8.     private float trackTime = 0.0f;
    9.  
    10.     void LateUpdate () {
    11.         trackTime += Time.deltaTime;
    12.         if (trackTime >= updateTime){
    13.             trackTime = 0.0f;
    14.  
    15.             //update GI environment (ambient lighting)
    16.             UnityEngine.DynamicGI.UpdateEnvironment();
    17.          
    18.         }
    19.     }
    20. }
    21.  
     
    Deleted User likes this.
  33. Tzan

    Tzan

    Joined:
    Apr 5, 2009
    Posts:
    733
    Thanks!
     
  34. Tzan

    Tzan

    Joined:
    Apr 5, 2009
    Posts:
    733
    Just tried it and it works great! Thanks again.

    I also noticed:
    Script off, set skybox on, see black, set script on, fixed!
    Then while still in editor play mode, turn script off
    Anything you do now is displayed correct, even removing the skybox, set to gradient then reapply the skybox, all with the script off, it still works.

    It seems it only needs to be called once, not sure what the impact is of calling that frequently.
     
  35. chingwa

    chingwa

    Joined:
    Dec 4, 2009
    Posts:
    3,784
    In a dynamic environment where lighting changes would affect the skybox (and thus the scene ambient) you would need to call the script again in order to update the skybox ambient contribution for the scene. If you're lighting doesn't change, or changes infrequently, you probably only need this script to get around the initial bug.
     
  36. Tzan

    Tzan

    Joined:
    Apr 5, 2009
    Posts:
    733
    OK
    I hadn't thought about changing skyboxes, makes sense.
     
  37. chingwa

    chingwa

    Joined:
    Dec 4, 2009
    Posts:
    3,784
    OK so this thread went kaput... probably due to my own inactivity :D I don't assume that these tips will work for everyone, but they are the standard steps I take whenever starting a new project and have always worked well for me. I would love to hear from anyone who's used this guide to make any improvements in their projects!
     
    Ony likes this.
  38. Stormy102

    Stormy102

    Joined:
    Jan 17, 2014
    Posts:
    495
    Just throwing in my own two cents here, but to "cheat" with the long GI compute times, we have an empty scene which we instantiate in our assets from bundles at runtime, removing the need for long compute times (it's just a light, with a skybox and a few UI elements). However, what's good is that the indirect light still works so it gives the effect of realistic lighting without the long bake time. Obviously this isn't good for all use cases, but its a good cheat
     
    theANMATOR2b, chingwa and scvnathan like this.