Forum Discussion

🚨 This forum is archived and read-only. To submit a forum post, please visit our new Developer Forum. 🚨
Fredrum's avatar
Fredrum
Expert Protege
12 years ago

Banding in dim Lighting

I have posted also on the Unity forums but thought I'd ask here too.

I am getting some strong color banding in my dimly lit scene, from the lighting/shading using the default Diffuse with a texture map and standard point lights without shadows. I haven't found a good answer to similar concers by others on the Unity forums.

Things that I have tried,
- Re importing/converting the shaders' diffuse textures with the highest color depth settings.
- Change the cameras to render HDR.
- Re-wrote the default diffuse shader that I used to swap fixed4 _Color -> float4 _Color

Here is a picture of how it looks (top half brightened in photoshop for clarity)



And before you say that it is maybe my graphics card take a look at the following radial grad created in Nuke. It does not seem to have the same banding at all.



Does anyone else get the same and does anyone have any suggestion for how to get rid of it?
(It is a bit hard to see in a bright room but very clear inside the rift.)

Cheers
Fred

8 Replies

Replies have been turned off for this discussion
  • drash's avatar
    drash
    Heroic Explorer
    Does changing to Linear lighting mode in Player Settings help?

    If not, I think it might be a DK1 display thing.
  • Fredrum's avatar
    Fredrum
    Expert Protege
    Yes I tried that too actually. The colors changed accordingly but the banding itself stayed the same.
    I also tried with the default camera and it looks the same then too, inside the rift and on my monitor.

    When I brighten up that screengrab back in photoshop I notice that the radial grad have been generated with built in dithering.
    I wonder if I am just used to software renderers and that those do this with their shading using various dithering and/or sampling methods? Maybe this is just what you get with a hardware renderer?

    Its a shame since it really breaks the realism of the scene.
  • The issue is caused by running into the limit of 24 bit color fidelity. This isn't unique to the Oculus, it's just made more apparent because of the enclosed design of HMDs let you see low brightness values more easily than on a monitor or tv in a normally lit room. If you look at your original image in photoshop with the color picker and RGB values you'll see each band is one value different.

    ie: you'll see the color values do something like this:
    R:4 G:4 B:4 -- very dark grey
    R:4 G:4 B:3 -- very dark orangish band
    R:4 G:3 B:3 -- very dark reddish band
    R:3 G:3 B:3 -- back to very dark grey

    The solution to this, and what Photoshop and Nuke do when creating gradients is effectively calculate the gradient at greater than 8 bit per pixel color accuracy and add very small amount of noise.

    Here's a close up of that gradient from Nuke heavily brightened in Photoshop to show the noise.
    https://dl.dropboxusercontent.com/u/49665566/gradientNoise.png

    Unfortunately for this to work well the dithering process has to occur as the last pass on the image before being sent to the display. Any distortion or image modification can cause obvious patterns or streaks to appear. Film noise have been a popular method to help hide these artifacts in darker games, but this isn't a good option for VR.

    edit: Also I'm pretty sure Carmack saw this post too as he complained about the issue (and solution) on Twitter.
    https://twitter.com/ID_AA_Carmack/status/486660710672248833
  • The issue is caused by running into the limit of 24 bit color fidelity. This isn't unique to the Oculus, it's just made more apparent because of the enclosed design of HMDs let you see low brightness values more easily than on a monitor or tv in a normally lit room.


    Thanks for sharing this! I'm seeing banding as well and this at least helps me understand why.
  • drash's avatar
    drash
    Heroic Explorer
    Thanks for the awesome explanation, bgolus! I wouldn't have guessed that I was able to perceive a single step of brightness, but that just goes to show how good the Rift can be in blocking out your surroundings.
  • Gerald's avatar
    Gerald
    Expert Protege
    "bgolus" wrote:


    Film noise have been a popular method to help hide these artifacts in darker games, but this isn't a good option for VR.


    Why is this not a good option for VR? I use it for months because it helps with artfacts and I feel the blurring in movements.
  • owenwp's avatar
    owenwp
    Expert Protege
    If you don't use HDR, its worse than 24 bit. Unity actually uses a logarithmic color encoding in its lighting system, which trades color value precision for slightly higher than 0-1 dynamic range. Also, when you make a gradient in an authoring tool, it probably does some dithering and maybe even LCD sub-pixel compensation automatically, which will yield a higher quality than you can expect from the output of a realtime shader.
  • Fredrum's avatar
    Fredrum
    Expert Protege
    Yes I started taking a look on the web to see if anyone had done any nice dithering shaders that I could steal. Then I got distracted by other things and just noticed that you guys had replied.

    I was also looking for a classic CG quote I seem to remember from some Pixar guy, I think it was. Something about that noise is the most aesthetically attractive cheat/solution to [these kind of problems?]. But I can't find it now.

    Gerald, you are saying that you have some kind of workaround? Any tips you could share? :)

    bgolus, oh yes of course you are right, about the distortion and not really wanting it to also distort the dithering/grain noise.


    (cool to think that I stumbled upon something that maybe Carmack is considering now :) )


    Cheers
    Fred