Home Technical Talk

Lightmap Gradient Problem

polycounter lvl 11
Offline / Send Message
Prophet polycounter lvl 11
Hello,

I would like to know if there's a way to remove this ugly gradients when you have Lightmaps with near black colors?

example01n.jpg

Enhanced contrast in Photoshop to be more noticeable what I mean:

example02s.jpg


I'm doing this with Unity, but since I saw this type of gradients in Left 4 Dead 2 as well, for example, I'm wondering this is a common problem.

Is there a way to fix this?

Replies

  • dirigible
    Options
    Offline / Send Message
    dirigible polycounter lvl 8
    the problem, as far as I can tell, is that you are using a very limited range of color in your lightmap (let's say, from 0 to 20 rgb). But then you're expanding that range back up with realtime lighting / post process / whatever. So you're taking 0 to 20 and turning it into 0-100. The result is gonna be banding.

    Here's a visual representation.
    I made a gradient, compressed it down to 0-20 rgb, then expanded it back up to 0-255.
    TYcmA.jpg
  • Santewi
    Options
    Offline / Send Message
    That's 8-bit textures in a nutshell for ya.
  • Prophet
    Options
    Offline / Send Message
    Prophet polycounter lvl 11
    But is there a way around it?
  • ZacD
    Options
    Offline / Send Message
    ZacD ngon master
    Avoid near black colors and/or use post processes to darken the screen while using a wider color range for the actual light map.
  • Prophet
    Options
    Offline / Send Message
    Prophet polycounter lvl 11
    I've tried with a Post-Process, not changing the actual color of the lightmap, but the problem is still there. And about the dark colors, this needs to be really dark inside at some points. :\
  • dirigible
    Options
    Offline / Send Message
    dirigible polycounter lvl 8
    That's very odd that it's happening even if you're only darkening the scene with a post process effect.

    Just to be sure we're talking about the same thing, you should light your scene like it's afternoon or something, then create a post process volume that darkens the scene to make it look like night time.
  • Ashaman73
    Options
    Offline / Send Message
    Ashaman73 polycounter lvl 6
    There is not much you can do. If unity supports other texture formats (float,16bit,openexr) you can try to pimp the resolution. Although check if you use sRGB textures, these have a lower resolution for lower values, a standard none sRGB texture might help.

    Dirigible ways is ok too, though you need to take care, that the bright places don't get toned down too, in this case you should use a none linear tone down, though if your overall scene is very dark this is the way to go.

    Although desaturate your scene in dark places, the eye can't barely see colors in a dark environment, this could smooth the banding effect too (no color shifts).

    And eventually use a texture, textures always help to break up artifacts .
  • Xendance
    Options
    Offline / Send Message
    Xendance polycounter lvl 7
    I'm guessing unity also compresses lightmaps with DXT, which certainly doesn't help you along with the problems stated above ;)
Sign In or Register to comment.