Home Technical Talk

Lightmap blending with modulate 2x

polycounter lvl 16
Offline / Send Message
Xoliul polycounter lvl 16
I've been having a discussion with AlecMoody about adding lightmap functionality to my shader. It's not in there yet, but I'd like to do it. He asked for modulate 2x blending of lightmaps. As far as I understood, that goes like this:
Value from lightmap is sampled and ends up in between 0 and 1.
That value gets multiplied by 2.0, expanding the range to 0 - 2
That value then gets multiplied with say your diffuse texture.

Now what I want to understand is, what are the implications of doing this, since it essentially overbrights all the pixels that have lightmap values over 0.5 ? I always thought lightmaps should just go from not lit to fully lit 100%. Any multipliers are basically light intensity, so i guess dependant on what lights your lightmap was rendered with.

Anybody care to shed some light ?

Replies

  • CrazyButcher
    Offline / Send Message
    CrazyButcher polycounter lvl 20
    if its in 0-1 range, things cannot get brighter than the diffuse texture, which doesn't look too well for bright light. Not enough contrast. lights typically can have intensities beyond 1, and especially the sum ambient + diffuse + specular would easily go beyond 1.

    While of course specular cannot be baked, say you have a bright torch next to a wall, you would get higher intensity values there.

    you achieve more color richness this way.
  • Xoliul
    Offline / Send Message
    Xoliul polycounter lvl 16
    Don't you at least want to be able to control lightmap intensity then ? Not every lightmap will be baked from lights that have their max value at 2.0
  • Brice Vandemoortele
    Offline / Send Message
    Brice Vandemoortele polycounter lvl 19
    Having the multiplier set to 2 was a constrain of fixed rendering pipeline. With current shader programmability you can definitely add more control over that.
  • Xoliul
    Offline / Send Message
    Xoliul polycounter lvl 16
    Allright, then modulate 2x is just a confusing name for multiplying with an intensity. Easy to add when I implement lightmaps :)
  • AlecMoody
    Offline / Send Message
    AlecMoody ngon master
    An adjustable multiplier would be great.
    If you really wanted to get fancy could you do some sort of adjustable tonal curve? That way you could control mid tone, shadow, and highlight contrast separately. I'm guessing the math and interface work for something like that would be pretty large.
  • Xoliul
    Offline / Send Message
    Xoliul polycounter lvl 16
    If I do that, I'd simply add ramped shading :) You could just have the lightmap, or regular realtime calculations control the ramp sampling.
Sign In or Register to comment.