Search Unity

How to make AAA graphics in Unity/Enlighten

Discussion in 'General Discussion' started by Billy4184, May 18, 2017.

  1. Deleted User

    Deleted User

    Guest

    @Billy4184

    Ummm, yeah.. Just kinda went ahead and did my own thing with your challenge :D.

    MegascanShadow.jpg

    MegascanShadowlight.jpg
     
    Last edited by a moderator: May 21, 2017
    Gametyme, Peter77, kB11 and 4 others like this.
  2. Frpmta

    Frpmta

    Joined:
    Nov 30, 2013
    Posts:
    479
    Does that use the amplify Sharpen filter?
     
  3. Deleted User

    Deleted User

    Guest

    Well I used Amplify to export a LUT then added a sharpen filter to the LUT in Photoshop.. So kind of yeah.
     
    Frpmta likes this.
  4. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,724
    Wait, does that work? It doesn't, right? At best it introduces some contrast and saturation.
     
    Martin_H likes this.
  5. Deleted User

    Deleted User

    Guest

    Meh, seems to work for me as displayed above..
     
  6. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,724
    Does Amplify use a LUT bigger than 256x16?
     
  7. Billy4184

    Billy4184

    Joined:
    Jul 7, 2014
    Posts:
    6,012
    Very nice..! Although I'd like to see it in warmer light, I think the blues wash away a bit of the atmosphere.

    Is that UE or Unity? Guessing Unity.
     
  8. nipoco

    nipoco

    Joined:
    Sep 1, 2011
    Posts:
    2,008
    That's all fine and dandy. But all I see are environment stuff.
    Nobody here seems to care about character art...
    I mean, maybe you just want to make a pretty scene, or a good looking walking simulator. But most games have character in it. And if they look uncanny, the best environments are worth nothing. See ME Andromeda...

    Character art is a whole different level, when you try to make it realistic. Something Unity definitely falls short. That is something Unreal handles definitely better as for now.
     
  9. Deleted User

    Deleted User

    Guest

    @AcidArrow

    It's a 1024X32 LUT..

    @Billy4184

    Added a warmer one just for you ;), Gotta admit this megascans stuff seems rather "busy" to me. Probably better blended with a proper terrain.

    P.S why did you guess Unity?
     
  10. Billy4184

    Billy4184

    Joined:
    Jul 7, 2014
    Posts:
    6,012
    OK here's mine, not perfect but getting there. Trying to go for a bit of a Horizon aesthetic.

    Untitled3.png
     
    kB11 and GarBenjamin like this.
  11. Billy4184

    Billy4184

    Joined:
    Jul 7, 2014
    Posts:
    6,012
    You know I feel the exact same way, I think if you look through their tiling textures (not the whole objects) there's much more game-friendly stuff there. I wouldn't really want to put this straight into a game.

    Edit: the warmer one looks better, but IMO would look better with even more saturated highlights .. anyway looks great.

    Mainly because I find that objects in Unity tend to not appear as 'solid' as in UE. The objects in UE tend to look 'painted with a thicker paint' (how's that for an analogy?) - more like an Uncharted aesthetic or something.

    I was fiddling around with my terrain in UE yesterday and just dropping it in, it felt more like real caked dirt, whereas the Unity version appeared more like the texture was painted onto a mesh. Not really sure at this point what it's all about, just the vibe I get.
     
    Last edited: May 21, 2017
  12. Billy4184

    Billy4184

    Joined:
    Jul 7, 2014
    Posts:
    6,012
    @ShadowK now I'm not so sure! I think the strong reflections are perhaps responsible for this look? Anyway, whatever it is the result is very good.
     
  13. Deleted User

    Deleted User

    Guest

    @Billy4184

    Wayyyy too orange..! If that looks neutral (even for a dusk scene) to you throw your monitor in the bin :D..

    I gotta ask, now.. At this junction is there a point to all of this? I'm not trying to blow my own trumpet but I've been looking at several games (like Arkham Knight, Crysis 3, Witcher 3, Nier) comparing it to the screenie I did in Unity from a lighting and composition standpoint, on some I don't believe it's worse and in other cases to me at least it looks better (in other words I'm not worried no matter the path I choose).

    What I did notice (again) about AAA is the sheer amount of amazing artwork, it would probably take a month to do the car alone.. I mean that's the real challenge here, I could never hope to come anywhere near that level consistantly.. I'd be reduced to doing what I did in that scene, 10 minute meshes and as you can tell from my screenshots 10 minute artwork doesn't really look that great does it? (although you see the odd mesh in large budget games that look worse than 10 minute art, must of been Friday LOL)..

    After this I personally don't see Unity as the sticking point if you play to its strengths, yeah I struggled with indoor / outdoor because the tonemapper becomes inconsistant and I agree with @frosted eye adapation isn't the solution. They need a UE style shadow caster / atmospheric tint for the HDRI skybox system and some post process volumes (which can change post settings as a player approaches an area). Also they could do with adding more bounces to the lightmapper, 4 isn't enough.. 15 would suffice.

    I believe a mixture of baked (progressive LM) and realtime GI for meshes that require it will be perfect. It's not necessarily about "the best", it's generally better to have systems that are well thought out.

    Finally that terrain system needs to have gone like yesterday.. This new one better be amazing.!

    Also as lightboxing shows, keep materials on the light / semi reflective side and in small instances you can beat AAA without that much effort.. But again it's not what this is about (just to mention, if you tried that quality level in a large scale game you'd be shipping six discs of lightmaps or taxing a 1080).

    Try and beat a linear static third person game like the last of us, I understand that this mainly for fun and a hobby for most.. But realistically I doubt you could come anywhere near, if you've ever embarked on a large project it's not necessarily initiating quality that's the issue, it's maintaining it.

    The one thing I've gotten out of this thread (reason why I participated) is to re-iterate my obsession with graphics is pretty much unjustified as I'd be happy with both Unity and / or Unreal. It's been a while since I've been through a scene to end process, because I spend most of my time developing the actual game. It's nice to re-affirm that nothings changed since the last time I went through this.
     
    Last edited by a moderator: May 21, 2017
    frosted, kB11, Martin_H and 2 others like this.
  14. GarBenjamin

    GarBenjamin

    Joined:
    Dec 26, 2013
    Posts:
    7,441
    Fantastic! Ya know it might be very cool is if this scene was your entire game world. And you create some very tiny characters (a player or two and some enemies). And there is your rpg. Only in top down exploring some alien world where everything is gigantic scale. Be cool for a RTS game as well. Anyway... just imagining out loud. Looks great!
     
    Martin_H and Deleted User like this.
  15. neoshaman

    neoshaman

    Joined:
    Feb 11, 2011
    Posts:
    6,493
    Well why not start another thread to do just that, I think everyone would be interested for this to have its own place. But unity don't have out of the box skin shader, and the one I followed seems to have issue with pbr integration. Lux is free if you are interested, and there is also another paying one on the asset store.

    Good luck with your thread :) maybe we would contribute with some scene if you start one for character to be integrated in ;)
     
    Martin_H and GarBenjamin like this.
  16. Billy4184

    Billy4184

    Joined:
    Jul 7, 2014
    Posts:
    6,012
    Look, you might be right, maybe it's not worth worrying about it. But all I know is that from what I've seen of the major (graphically) games currently made or being made with Unity - The Outsiders, Prey for the Gods, and Recore - although I have been impressed by story and art direction, they do not impress me overall graphically. Why? Not really sure, `lighting' I guess. I'm still trying to figure it out.

    In the meantime, I'm not bashing Unity's graphics - it's pretty good for sure and for all I know there are things available now that these games do not use - such as the progressive lightmapper for instance. So I'm not really interested in beating a drum about it - that's the reason I made this thread, so we could simply get stuck into making the best of it. It's up to everybody to decide what they're happy with.
     
  17. nipoco

    nipoco

    Joined:
    Sep 1, 2011
    Posts:
    2,008
    Nah I'm personally not interested in creating fully realistic characters. Even stylized ones are difficult enough. Besides that, I don't have the time for that.

    I just noticed this thread is focused on environment stuff only, without discussing the crucial part of characters in a game.
     
    Martin_H likes this.
  18. Billy4184

    Billy4184

    Joined:
    Jul 7, 2014
    Posts:
    6,012
    Yeah for sure! It's not meant to be neutral lol, as I said it was supposed to look a bit like a Horizon Zero Dawn environment, probably still too red though.
     
  19. Deleted User

    Deleted User

    Guest

    I believe the point is you just gotta suck it up and do what's right for you and your project, when it comes to the two main engines it's six of one / half a dozen of the other. Some things are harder, some things are easier on both accounts.. I'm not sure why you wouldn't dip in the other pool if something irks you that much..

    Also Unity isn't most likely going to change for you, even if they do from community pressure it might take years before it actually gets implemented. So I doubt we can do much about even if there really is a fundamental issue (or missing feature)..
     
    Billy4184 likes this.
  20. Billy4184

    Billy4184

    Joined:
    Jul 7, 2014
    Posts:
    6,012
    OK just for fun.

    Unity:

    Untitled3.png
    UE:

    Untitled4.png
     
    Last edited: May 21, 2017
    Gametyme, kB11 and GarBenjamin like this.
  21. GarBenjamin

    GarBenjamin

    Joined:
    Dec 26, 2013
    Posts:
    7,441
    Gametyme and neoshaman like this.
  22. Billy4184

    Billy4184

    Joined:
    Jul 7, 2014
    Posts:
    6,012
    Yeah I guess I will. Anyway, I'm not going to be going on about comparisons much, it's kind of pointless since a lot of people are quite happy with Unity the way it is, so the thread is basically for improving our skills in Unity. Just thought I'd throw that up there ^^ so I can say I've at least done something in both.
     
  23. Billy4184

    Billy4184

    Joined:
    Jul 7, 2014
    Posts:
    6,012
    What do you think is better about it?
     
  24. GarBenjamin

    GarBenjamin

    Joined:
    Dec 26, 2013
    Posts:
    7,441
    The wood. Although both images show an exaggerated amount of light at spots the Unity image seems to have it happening more on the rocks and the UE image has it happening more on the wood. I find it more natural and realistic to happen on the rocks than I do on the wood.
     
    frosted likes this.
  25. Billy4184

    Billy4184

    Joined:
    Jul 7, 2014
    Posts:
    6,012
    Well, I think the rocks at the top of the UE image look much nicer and more 'correct' but I agree the bottom ones don't have it going on.

    The highlights and shadows are a bit messed up in the color correction, not quite sure how to get it right there. UE seems to have only two settings there (high/low) and Unity have 3 (high, mid, low). Anyway I found that the cold hues leaked into the warm hues a lot and especially with UE's auto exposure it became quite hard to adjust things.

    I didn't add any cubemaps or reflections at all either, just dropped it into the scene pretty much and tweaked the post effects. I'm extremely new to UE (probably the third or fourth time I've opened it) so I'm not even claiming really that it's a 1:1 comparison.

    For the record, I think the UE one looks significantly better in terms of the core lighting but I definitely messed up the post a bit.
     
    GarBenjamin likes this.
  26. GarBenjamin

    GarBenjamin

    Joined:
    Dec 26, 2013
    Posts:
    7,441
    Could be just a difference in way we view things too. We all have our own filters. The UE image my eyes are immediately drawn to the washed out overexposed section of it. Probably because in that scene the log seems to be the focal point.

    I am also on my cell and maybe the images will look very different when I am on my laptop tomorrow.
     
    frosted and Billy4184 like this.
  27. Billy4184

    Billy4184

    Joined:
    Jul 7, 2014
    Posts:
    6,012
    Yeah to me the UE one looks more like a photo that someone has messed with in photoshop, whereas the Unity one looks much neater but 'flatter'.

    Also agree about it being overexposed, there's definitely stuff to improve.
     
    GarBenjamin likes this.
  28. Blacklight

    Blacklight

    Joined:
    Dec 6, 2009
    Posts:
    1,241
    Saw this thread and the challenge and thought it might be fun to have a go. Mind you I don't think I have any of the understanding of this kind of thing that most of you seem to have.
    riverbed_quixelScene.png
     
  29. Martin_H

    Martin_H

    Joined:
    Jul 11, 2015
    Posts:
    4,436
    There are plenty of games without characters being prominently visible. It's a smart choice for indie games to avoid them rather than do them poorly. Environments are much more forgiving and achievable for indies.

    Did you use HDR linear colorspace? To me that looks like gamma colorspace in both.

    Yeah, I gotta agree. The main thing I got from the image I did was that @hippocoder was spot on. I've used nothing but my knowledge of art- and lighting fundamentals, and the kind if scene is perfect to cheat on in ways that are impractical for other scenes. I didn't use any baked lighting as all, I tweaked the environment lighting gradient to give cool light from the top and warm light from the sides, because that's the color indirect light would mostly have from these directions, and I used SSAO to "cut away" indirect light from the occluded areas. It's fine for this scene but if you add architecture and want to transition to indoors it would look wrong.
    I'm still on 5.5 and the old light baker is terribly un-fun to work with. Feedback is close to non-existent, you always think it just crashed (it kept displaying a 15/16 progress meter forever even after I switched baked lighting off), and I have little interest in learning that stuff anyway, since I can't use it in my game. Which brings me to the next point. How well does your hallway setup scale up to be made into a game? That's a question that should be very interesting for you to answer with your next scene, where you said you wanted to do something specifically for your game (iirc). I'm not sure what the best way to test something like that would be, because I lack experience with lightbakers. I'd imagine some setups that still work for an isolated hallway just take waaay too freaking long to bake if you have a full level. And as far as I remember that was one of your main complaints about Unity in the past, when you tried to scale up to proper game amounts of stuff and it no longer performed well enough.


    @Billy4184: What would be a scene that has the most immediate use for your current game? Maybe it would be better to just work with that. I would do the same with something for my game, but I'm not quite there yet in terms of having enough assets ready. I've spent a bit of time yesterday looking at Google sattelite images in 3D view, where they project everything on 3D geometry of buildings and that looked somewhat close to what I want. It was very interesting to see actual realworld examples of GI in a consistent light and photography setup. @frosted posted a link about "the inverse square law of light" and that was very interesting to think about while looking at real world examples. In most cases the bouncelight from lit surfaces reflected into shadowed surfaces is actually really subtle and I think SSAO does much more to get me closer to the result that I want, than light baking would. Which is good, because I can't use lightbaking in my game.
    @hippocoder is right that most of what's relevant here is a question of art direction and that's outside the scope of "let's make a thread about it and catch up on that" because it's too deep a topic. But what I think would be an achievable and useful thing to research is how to get a stable art pipeline where you get a preview in Substance Painter that is very close to what your asset will look like in your game. That's something where I see potential for improvements that result in both saved time and better quality. I recently spent an hour trying to recreate the SP2 shader in Blender's cycles, so that I wouldn't see vastly different results each time I switch applications. I think that one will pay off.

    One very specific question I would be interested in regarding lighting in Unity is: Is there a way to tweak light and post without tweaking textures, to reduce the contrast within lit and shadowed areas respectively, but increase the contrast between lit and shadowed areas? That's something where I feel more control would be useful for me to get the result I want, but I'm not sure if there's a hack to get that kind of control. @frosted had some nice examples in the other thread and I've also seen that kind of advice in the context of painting literature. "A black thing in sunlight can be brighter than a white thing in shadow" or something like that. I fear this might be a thing of calibrating PBR albedo value ranges, but if there is another way I'd like to know it.
     
    frosted likes this.
  30. Elzean

    Elzean

    Joined:
    Nov 25, 2011
    Posts:
    584
    Having good PBR assets are essentials. Without it no amount of tweaking GI or light will save the scene.
    Once you have fine assets having a skybox, a few reflection probes, and post process you should rapidly getting something decent.
    You will have to understand how the various debug histogram are used, those kind of video can help (there is bunch of others):



    It should help you to set up the eye adaptation to get decent exposure.


    Once you get how to have good exposure the scene should start to look pretty good, at least technically, artistically that's up to you (Image composition, colors etc...)
     
  31. frosted

    frosted

    Joined:
    Jan 17, 2014
    Posts:
    4,044
    Is it possible to remove the post from both of these?

    In general, the overall color in the Unity shot "feels better" to me, but the highlights are totally blown out, and the ratio of dark to light is super high contrast. A lot of that has to do with the tonemapping, so I'd just be interested to see what the two shots look like with no post at all.
     
  32. frosted

    frosted

    Joined:
    Jan 17, 2014
    Posts:
    4,044
    Over the last week, from all this discussion, I've been learning how to use the histogram and judge exposure. HDR color ranges are also somewhat challenging and add some trickiness here.

    But this kind of thing is super important, and those vids are really good intros.
     
  33. DominoM

    DominoM

    Joined:
    Nov 24, 2016
    Posts:
    460
    Here's a starter project for anyone who wanted to use the Sponza model. Should just be a case of unzip and open in your preferred Unity version. I did try to make a prefab package but the vase_rounded kept breaking and I couldn't figure out a quick fix. So in the end I just zipped the assets folder.

    Crytek Sponza for Unity
     
    frosted likes this.
  34. frosted

    frosted

    Joined:
    Jan 17, 2014
    Posts:
    4,044
    I think this is really a big thing, again, I highly suspect that too much "brightness" is coming from color not from light in a lot of rigs.

    One of the things I liked most about @ShadowK's Unreal hallway is that 100% of the brightness was coming from light (or appeared to be). In the Unity shot, the materials and colors seemed to determine brightness far more than the amount of light hitting a given spot.

    Maybe I'm crazy. But I think that, often the processing is essentially creating light often where it shouldn't be.

    Today is a super bright sunny day, I look at a parking lot in the apartment complex I live in. The cars are all kinds of colors, all metalic, and gloss. Black cars and Red cars and White cars, all of them are equally bright. What's more, even with a high gloss finish, they are not brighter than nearby grass or even asphalt.

    The high gloss finish just makes the surface reflective, it doesn't make it brighter (if that makes sense -- like the net brightness is the same on a high gloss surface as a low gloss surface - a high gloss surface just makes the colors reflected sharper - so you can make out exact details in the reflected light).

    Reflections don't make things brighter, they just don't distort the colors being bounced around - so you can make out the original colors being reflected clearly... I probably sound like a nutcase at this point :)

    I think you can also see this in @GarBenjamin's photos. Color != Brightness, Light == Brightness. But when photos are being processed, more and more brightness is coming from the colors themselves rather than difference in lighting.

    Maybe it's not fully creating fake brightness, but at minimum it's exaggerating the differences to such a degree that it ends up becoming its own thing. The ratio of light to dark starts to become far too high.
     
    Last edited: May 21, 2017
    Deleted User and GarBenjamin like this.
  35. Billy4184

    Billy4184

    Joined:
    Jul 7, 2014
    Posts:
    6,012
    Frankly, I just dropped the object in the scene and tweaked a few post and light settings. I didn't set up a reflection cubemap or anything, there's a lot of stuff I'm not familiar with in UE. It was just whatever I could come up with in an hour or two.

    For now I don't know exactly, since my current project is mobile, what I'm doing here is just experimentation and trying stuff out.

    I might try that. I agree that the Unity shot was more pleasing to the eye, but IMO the UE one had significantly more of a sense of space and ambience although the colors were pretty off and it was overexposed.

    Anyway, I'm still a total noob in UE so I don't think it's worth analyzing that comparison too much. I think I just need to spend some time practicing and getting comfortable with how stuff works there (and improving my graphics skills in Unity as well), and then later on down the line I will decide what's best for my next project.

    In the meantime, I'm mainly just going to post here my experiments in Unity.
     
  36. frosted

    frosted

    Joined:
    Jan 17, 2014
    Posts:
    4,044
    There's far more blue in the UE shot, which might give that nice "ambient" feeling. Maybe skybox reflection? The shadow under the log is straight purple in the UE shot, vs brown in UT.

    puple light.png

    Circled region is straight up purple in shadowed area. I imagine this is ambient light from skybox?

    UE version has tons more blue spectrum everywhere.

    I personally feel that a picture tends to feel more "pleasing" when it uses a wider color range, more blues/greens/reds mixed together. I would bet that if the UE version was lower contrast it'd "feel" better than the Unity version for this reason (although you can certainly add more blue to the Unity version also - just add more blue ambient light). The Unity version still feels good IMO, because there's a lot more green there.

    I don't understand why the rocks are blown out so badly in the Unity shot. The rest of the color seems to be in very good range, but the rocks are so over exposed it's crazy. I feel like this is a very, very common problem with Unity post. Maybe the default settings just tend to make this happen?

    _____
    EDIT: Just as a note - I am not criticizing - just breaking down each of the elements as best I can. The over exposure on the rocks just strikes me as odd, since it doesn't feel like the rest of the shot is over exposed, so why is the light sooo bright reflecting off the rocks?

    This over/under exposure thing is a problem I've spent a bunch of time trying to wrestle with myself, it just seems very difficult to get a good balance. It's really hard to get the bright spots under control. Whereas, without tweeking, it looks like the Unreal version is much more even (despite the contrast being cranked up too high!)

    Is this just a case of better default values? Maybe UE eye adaption is keeping everything more balanced?
     
    Last edited: May 21, 2017
  37. Billy4184

    Billy4184

    Joined:
    Jul 7, 2014
    Posts:
    6,012
    Could be, but I find that adding blue in Unity doesn't change things in that sense.

    The main reason why it's more blue is that UE have only 2 levels of color correction, so it was much harder to adjust the shadows with blue without it leaking into the mid-range.


    If you drop something into a new UE project, it's pretty hazy, blurry and blue. Yet it still looks somehow more like a photograph in a way.

    Not sure, but it's definitely not as badly blown out as the UE shot.

    Anyway, I'm going to practice, post some stuff if I think it looks good, and maybe we can do a few more challenges as well.

    No doubt @ShadowK won this challenge IMO, @Martin_H came pretty close though. I was trying for a less specular look, more look like the reference pic - and a bit stylized as well - but didn't turn out all that great. @Blacklight's one looks good, but needs a bit more tonemapping imo :)

    I'm still interested in fiddling around with this scene to reach the aesthetic of the reference pic (which I believe is UE) but probably have a ways to go to get there.
     
    Martin_H likes this.
  38. frosted

    frosted

    Joined:
    Jan 17, 2014
    Posts:
    4,044

    Just for record, this is a little pic from the Wiki on how the eye adjusts to brightness. There are two different physical mechanisms depending on how intense the light is.

    There's a different mechanism at very high intensity that creates a different curve. I basically think this is what might be happening in Unity post, the top end of the intensity spectrum is not adjusting correctly and is kind of exponential instead of having an entirely different curve near the top end.

    It's also possible that I have no clue what I'm talking about ;)
    https://en.wikipedia.org/wiki/Adaptation_(eye)

    It's worth noting that this may be entirely different in the human eye vs a camera, where the camera is more consistent.
     
  39. Deleted User

    Deleted User

    Guest

    @Martin_H

    Not very, in the lightbox example lightmass was set to a 100 bounces.. Yeah, that's way over the top and you can get away with around 15 in arch viz but the amount of 2K uncompressed lightmaps it required to get the "perfect" lighting just wouldn't be applicable in a game of any decent scale.

    UE does bake pretty damn fast though, that scene took around 2 - 3 minutes at full production level a whole City usually takes around 45 minutes to two hours (that's if I leverage a couple of servers). Unity's new lightmapper took 15 minutes (one directional, 4 area lights), but of course it's still a wip.

    In both of them there is a preview until you decide to actually bake it (which is handy).

    @frosted

    It will to some extent, that's how GI works.. Look at a cornell box example, you'll notice colours bouncing back which also affects the level of brightness when said colour is darker.. But you are right, in the real world the effect is far more subtle and things like ACES exacerbates too many issues.

    In UE there's two options to modify the output of the tonemapper called "slope" and "toe", this helps to balance out what the tonemapper does (which you can do in photoshop, but it makes life easier having direct control). There was a specific reason I chose indoor / outdoor and there is a specific reason for tech like UE's DFAO / skylight based ambient shadows, it helps to make the scene uniform.

    Eye adaption is useless for long distance items, it only seems to affect what's being fed in the immediate viscinity of the cameras position...

    If you could balance out the two you'd have a far more realstic scene, because you could then brighten the shadows and again uniform everything without affecting the outdoor portion.. At the moment it's like a pendulum and I understand why, if you were to build a game like Skyrim all internal scenes would be in their own rendering zone so you just adjust and fake it so this wouldn't be an issue.

    Now if you were going for a game like W3, this would of course be an issue (but this isn't a problem for many dev's so they probably never considered it).. Not that you couldn't solve it on your own (ambient shadows), also light falloff does have a part to play so using something like Alloy would go someway towards fixing this.
     
    Last edited by a moderator: May 21, 2017
    Martin_H likes this.
  40. frosted

    frosted

    Joined:
    Jan 17, 2014
    Posts:
    4,044
    I've been doing a lot of reading about the biology of the eye. I'm considering trying my hand at a custom tonemap/eye adaptation system.

    Theory: the way we measure color/brightness has been traditionally based on photography and recreating photographs. So we tend to measure luminosity/brightness using green spectrum color. In a 3d engine, I don't think you need to do this, you can actually measure the amount of light hitting any given spot.

    As I understand it, in the eye, two different types of cell measure brightness and color (rods measure brightness, cones measure color).

    This is a graph of how the different cones respond to light compared to rods:

    In terms of measuring "luminosity" we use green as the dominant measure. This makes sense to some extent as the green receptors are closest to the same response curve as rods (black dotted line).

    But rods and cones have very different sensitivity and respond to light differently.

    This is the aces curve.


    This is how our actual eye responds to light.


    Y = 0.2126R + 0.7152G + 0.0722B
    This is the calculation used for luminance or brightness. The thing is, this is a linear calculation.

    That kind of thing makes sense when dealing with photography or film, but in a 3d engine, again, you have access to actual lighting data. So you can apply separate curves to brightness, instead of making brightness a function of color.

    I'm not sure if I'll really have time, but I am super keen on trying to build a much better process for dealing with color and brightness.
     
  41. Martin_H

    Martin_H

    Joined:
    Jul 11, 2015
    Posts:
    4,436
    I said I had no baked lighting in my scene but it turns out prebaked realtime GI stays active on the baked objects even if you uncheck it in the lighting options. You need to build the lighting again after disabling all GI to actually remove it from the scene. I found that very unintuitive and I guess that also means you need to discard and rebake the GI if you want to have a with/without comparison.


    Did you do that in Unity too? The defaults of a new project are wrong for what you want to achieve. You need to change the colorspace from gamma to linear in the player settings, change the camera to use HDR, and when you wanna use forward rendering path you need to deactivate msaa because it disables HDR otherwise. I always use deferred.


    I think they didn't implement something so obscure and you're just seeing the effects of an incorrectly setup lighting pipeline where information gets clipped off at the top end of the LDR value range.



    After playing around with settings some more I (somewhat) got a grip on the eye adaptation (docs are here by the way: https://github.com/Unity-Technologies/PostProcessing/wiki )
    After setting that up to auto expose very freely this is what it looks like to just turn the sun light intensity from zero upwards to around ~4 and back again, then stopping at ~2:
    5mb gif:
    http://i.imgur.com/Gpmm41F.gif



    Let me stop you right there and suggest you go back to making your game! That rabbit-hole is a huge waste of time for you in my opinion. If you wanna procrastinate read a good art-fundamentals book on photography or painting, with focus on composition, color theory and light. You'll get far greater benefit from it than re-inventing the eye adaptation/tonemapping wheel.
     
    neoshaman likes this.
  42. frosted

    frosted

    Joined:
    Jan 17, 2014
    Posts:
    4,044
    Hey man, everyone needs a hobby. Writing a custom tonemapping system is a way more productive way to relax than sitting in front of a TV or something.

    Plus, aren't you curious as to how that might change the visuals? Has tonemapping/eye adaptation ever been done using actual light calculations instead of inferred from color?

    Might be really cool!
     
  43. Arowx

    Arowx

    Joined:
    Nov 12, 2009
    Posts:
    8,194
    That's fascinating but we are relying on the artificial colour from a display, which limits the range of colours we can present to the eye. Then you have the unique user settings of the display. And lighting conditions the display is viewed in.



    Playing around made an Overwatch Gun based on the Soldier 76 one. Shows off the depth of field effect.
     
    iamthwee and frosted like this.
  44. neoshaman

    neoshaman

    Joined:
    Feb 11, 2011
    Posts:
    6,493
    You might has well start looking at color space and their design
    https://en.wikipedia.org/wiki/Color_space
    So the answer is yes (that's the whole point of HDR and PBR, ie using real world data to drive visual) but in reality it is anything but trivial (due to color space conversion between the different input and output sensibility vs the math, and the real math is in wavelength, not color, and magenta don't exist in real life). Stop using color and start using albedo.

    I have putting away that rabbit hole for a moment.
     
    frosted likes this.
  45. Martin_H

    Martin_H

    Joined:
    Jul 11, 2015
    Posts:
    4,436
    If it fits your idea of fun and relaxation go for it!

    I just don't quite see what you hope to achieve with this. I don't really care about how "physically accurate" things are, because reality is dull and ugly and I'd rather see something pretty and idealized in games. If you said "I have this wacky math that follows no rules but gives this cool visual effect" I'd be more interested than in something super scientific, that probably won't make that much of a difference visually. Or at least you have yet to demonstrate what it is you'd want it to look like.
     
  46. frosted

    frosted

    Joined:
    Jan 17, 2014
    Posts:
    4,044
    I think there's a big difference between tonemapping and eye adaptation and PBR/HDR.

    PBR is trying to better represent how light is reflected.
    HDR is mapping light to a wider range.

    I'm talking about how the eye responds to brightness and color. We traditionally infer brightness from color, so when we apply luminance based calculations, what we're doing is adjusting the image based on color range (how much green mostly).

    Luminescence Calculation -> Eye Adaptation -> Tonemapping


    The right side of this gradient is much brighter according
    to the luminance calculations we use in eye adaptation.

    What if, instead of calculating Luminescence from the intensity of green, we instead simply use the amount of light - since this is a known quantity in a 3d environment?

    At this point, I might be derailing the thread. So I won't post more about it, except maybe results if I actually get around to writing something like that.
     
    Last edited: May 21, 2017
  47. neoshaman

    neoshaman

    Joined:
    Feb 11, 2011
    Posts:
    6,493
    It's the first time I have heard this been derive from green so I'm confused lol, I'll research a bit more to understand that perspective. I Know there were discussion about more bit to green (565) in 16bits representation, but that's all lol.
     
  48. frosted

    frosted

    Joined:
    Jan 17, 2014
    Posts:
    4,044
    Code (csharp):
    1.  
    2. #define unity_ColorSpaceLuminance half4(0.0396819152, 0.458021790, 0.00609653955, 1.0)
    3. // Converts color to luminance (grayscale)
    4. inline half Luminance(half3 rgb)
    5. {
    6.     return dot(rgb, unity_ColorSpaceLuminance.rgb);
    7. }
    8.  
    ^^ from cginc

    its basically just the amount of green. That's the basis for the eye adaption calculation which feeds the tonemapper.

    This kind of thing makes sense when you're dealing with a photo, or film, because all you have is the color (rgb in digital), but in 3d engine you have access to the actual light values.

    https://en.wikipedia.org/wiki/Relative_luminance
     
    Last edited: May 21, 2017
  49. neoshaman

    neoshaman

    Joined:
    Feb 11, 2011
    Posts:
    6,493
    Wait a moment, I'm being dumb ... that doesn't make sense lol color IS light! Color are different wavelength of light, white is just the combine intensity of all wavelength, luminosity isn't an independent property. In fact "white" is an illusion it doesn't actually exist (it's a not a specific wavelength of electromagnetic signal).

    Brightness has always a problem to me because looking for data all I learn is that there is multiple model depending on what you want to achieve and RGB is just a type of representation that abuse how eyes interpret colors, so we have to convert from wavelength to it. That's why we use albedo (and purist will be adamant they are not color, but the radiance flux or something lol). Using proper math would be in wavelength space, and I met this when researching skin shader, apparently there is nasty integral, hence why se try to find approximation in rgb space.

    The unity cginc might just be a hack to get good enough result at low cost, generally we do a dot product of something like color.rgb dot C(0.2xxxR, 0.7xxG,0.07xxB) [barely remember the proper number lol] in linear space which is LUMA IN Lab colorspace (I think). As we see Green is having the greater contribution in that colorspace it seems like green define luminance.

    The problem is brightness mean different thing in different color space ... I had already bash my head on this and now basically trust the adobe version and just greyscale an image (I'll look at the algorithm some day), which has been allowed me to reconstruct image faithfully after separation of hue and saturation.

    I mean look at this image:


    This is CieLab L


    This is luma Y


    This is component average (intensity)


    This is HSV value
    *
    This is HSL lightness
     
    Martin_H likes this.
  50. frosted

    frosted

    Joined:
    Jan 17, 2014
    Posts:
    4,044
    There are tons of different ways to calculate different grey scales (convert color to light/dark).

    Open up Unity. Throw tonemapping on a camera and look at any scene. Look at the histogram, switch the histogram between RGB and Luminosity.

    - What you'll notice is luminosity is essentially your green spectrum (since that's how the calculation works).
    - Eye adaptation takes the average luminosity on the screen and calibrates the tonemapping based on that value.

    In 5.4.1 at least, the "luminosity" of a scene is calculated (in linear space):

    luminosity = (Red * 0.039) + (Green * 0.458) + (Blue * 0.006)

    In gamma the numbers are:
    r: 0.22
    g: 0.707
    b: 0.071

    those are basically equal to the calculation on the wiki page
     
    Last edited: May 21, 2017