PDA

View Full Version : How Multiply actually works!!!

fxnut
02-11-2004, 10:54 AM
Hey guys,

Just thought I'd drop this by you to (hopefully) enlighten all those people who have been trying to figure out how the heck Lightwave's Multiply layer blending mode works.

In a nut shell, it composites the square root of the current channel value multiplied by the layer value, on top of the existing value. Err... in plain english, it does this... If you have a basic luminosity value of 50%, and you add a Value procedural at 100%, the final value will actually be 70.7%. This is worked out like this...

50% is represented as 0.5, and 100% as 1.0. So 0.5 multiplied by 1.0 is 0.5. Do the square root of that and you get 0.707, which is 70.7%. The formula, therefore, is this:

result = (A*B)^0.5

The above assumes that there is no transparency involved (and will usually suffice when trying to figure out what's going on). If you need to involve the transparency of the layer (or the transparent parts of the procedural), then you need to use this:

result = oldValue*(1.0-alpha) + ((oldValue*layerValue)^0.5)*alpha

where alpha is 1.0 when the layer is completely opaque, and 0.0 when it's transparent.

I'm sure you'll agree that this is a far cry from how most people would expect a multiply mode from working (especially after using a package such as Photoshop). For a Photoshop multiply layer mode, the last formula should have been something like this:

result = oldValue*(1.0-alpha) + oldValue*layerValue*alpha

The problem with Lightwave's multiply, is that applying a layer in multiply mode can actually increase the value in the channel. Something which is quite counterintuitive.

But anyway, I'm working on trying to figure out the others (divide, subtract, etc.), so I'll keep you posted!

Regards

Andy

BTW, see this message for a more SDK oriented discussion:

Message number 10378
http://groups.yahoo.com/group/lw-plugin/message/10378

(NOTE: in the Yahoo post, the alpha is the opposite to what I've mentioned here. This is because of the value that SDK provides when evaluating a layer. I just swapped it around here, to provide clarity for people who don't use the SDK - I hope that doesn't cause too much confusion!)