AuthorTopic: [Discussion] Cancelling out transparency overlays?  (Read 1446 times)

Offline Tetiro

  • 0001
  • *
  • Posts: 31
  • Karma: +0/-0
  • Leader of Grandpa Pixel
    • View Profile
    • Grandpa Pixel

[Discussion] Cancelling out transparency overlays?

on: November 03, 2011, 04:25:02 pm
Today's discussion is a good one. Let's start with an example. In this example, the overlay is a black with h,s,v of 40,40,40 and is 50% transparent.

Now, imagine you're playing a game. And you go into a dark-ish cavern. The whole screen gets a overlay of this colour. Now suppose you walk near to a light. The area around this light would need to have the overlay Cancelled Out.

My discussion is this. What would you think is the best idea for this? I thought about applying on the areas affected to be cancelled the colour that is opposite of the current overlay. In this scenario, a colour white with a h,s,v of 215,215,215 and is 50% transparent.

I'd like a good discussion please. I'm curious how you graphic artists would go about this.

Offline ptoing

  • 0101
  • ****
  • Posts: 3063
  • Karma: +0/-0
  • variegated quadrangle arranger
    • the_ptoing
    • http://pixeljoint.com/p/2191.htm
    • View Profile
    • Perpetually inactive website

Re: [Discussion] Cancelling out transparency overlays?

Reply #1 on: November 03, 2011, 04:56:40 pm
If you want to make everything uniformly darker apart from some bits, then you should generate a mask from the area which will get darker. So if there are bits which are lighter you define an area which they occupy and that then gets drawn onto the mask and thus not rendered dark. Hope that makes some sense.
There are no ugly colours, only ugly combinations of colours.

Offline surt

  • 0011
  • **
  • Posts: 570
  • Karma: +0/-0
  • Meat by-product
    • not_surt
    • http://pixeljoint.com/p/2254.htm
    • View Profile
    • Uninhabitant

Re: [Discussion] Cancelling out transparency overlays?

Reply #2 on: November 04, 2011, 05:33:20 am
As ptoing said if you want some of the image not to get darker then don't darken it.
You mention "overlay" but I don't get the impression you are talking about the blending mode which (according to Wikipedia) widens contrast, rather than lightening/darkening.
Alpha blending white over an image doesn't lighten it so much as wash it out. If you want to lighten then either use multiplication or addition blending, depending on the effect you're after.
Unless you are using a float-based work buffer I would recommend you perform the absolute minimum image arithmetic and keep it to a single blending pass. An 8-bit integer colour component doesn't posses the precision to perform complex low-error arithmetic, and it is even worse if you are performing non-RGB colourspace operations on an RGB buffer (all your HSV).
If you want a light buffer that can both lighten and darken the source image then I would recommend you multiply by a light buffer scaled to a 0-2 range.