Blend and interpolation modes for the manual

In many videos I see and texts I read, I often encounter the phrase “…and then play with these blend types until you find one you like”. While the click-and-pray approach is a very valid technique, I think it would be better if Blender users had an understanding of what exactly these blend modes do and how they work, so aimless clicking would at the very least become educated guessing :slight_smile:

In this thread I’d like to gather the information about all various blending modes Blender uses throughout it’s toolset (textures, materials, compositing, etc.) so that it can be compiled into a nice table and then put into Wiki, along with links in the pages that reference these modes (so that the documentation contains something meaningful instead of just a screenshot of the list of blending modes). I understand there are sites such as http://graphicssoft.about.com where you can learn about how all these modes work in principle, but it would be nice to have the info right there in the Wiki, with concrete explanation on how Blender implements its blending modes. Also I’d like to include formulas so artists and users with math knowledge can take advantage of that as well.

So here goes, my current understanding:

(LEGEND)

a - base (first) layer, i.e. source image, base color
b - blend (second) layer, i.e. texture, color ramp value
f - blending factor (Factor, Fac, Alpha where applicable)

a[SUB]i[/SUB] - per-component operation (i.e. comparisons and computations are done separately for RGB values)
a[SUB]H[/SUB], a[SUB]S[/SUB], a[SUB]V[/SUB] - hue, saturation and value elements of a single fragment

mix(a,b,f) = a⋅(1-f) + b⋅f = a + f⋅(b-a)
HSV(h,s,v) - compose a single fragment out of hue, saturation and value parameters

[TABLE=“class: grid, width: 100%, align: left”]

[TH]Blend mode[/TH]
[TH=“width: 33%”]Formula[/TH]
[TH=“width: 33%”]Description[/TH]

Linear Light
a + f⋅(2⋅b - 1)
Brightens base layer depending on blend layer. If blend layer is more than 50% bright, base layer is brightened by the blend layer values, otherwise it is darkened by the blend layer values

Soft Light
mix(a, mix(b⋅a, 1-(1-b)⋅(1-a), a), f)
Lightens or darkens base layer depending on the blend layer brighntess. The effect is softer than that of Linear Light or Overlay modes, with pure white and pure black blend layers not yielding pure white/black results.

Color
mix(a, HSV(b[SUB]H[/SUB], b[SUB]S[/SUB], a[SUB]V[/SUB]), f)
Mixes hue and saturation of the blend layer into the base layer

Value
HSV(a[SUB]H[/SUB], a[SUB]S[/SUB], mix(a[SUB]V[/SUB], b[SUB]V, [/SUB]f))
Mixes value of the blend layer into the base layer

Saturation
HSV(a[SUB]H[/SUB], mix(a[SUB]S[/SUB],b[SUB]S[/SUB],f), a[SUB]V[/SUB])
Mixes saturation of the blend layer into the base layer

Hue
mix(a, HSV(b[SUB]H[/SUB], a[SUB]S[/SUB], a[SUB]V[/SUB]), f)
Mixes hue of the blend layer into the base layer

Burn
1 - (1-a)÷mix(1, b, f)
Raises intensity of the base layer the darker the blend layer is

Dodge
a÷(1-f⋅b)
Decreases the intensity of the base layer the brighter the blend layer is

Overlay
mix(a[SUB]i[/SUB], 2⋅b[SUB]i[/SUB], f) if a[SUB]i[/SUB] < 0.5,
1 - mix(1, 2-2⋅b[SUB]i[/SUB], f)*(1-a[SUB]i[/SUB]) otherwise
Combines Multiply and Screen modes. The darker the base layer, the more the blend layer influences the mix.

Lighten
max(a, f⋅b)
Any fragments of the base layer that are darker than those of the blend layer are replaced by the blend layer fragments

Darken
min(a, f⋅b)
Any fragments of the base layer that are lighter than those of the blend layer are replaced by the blend layer fragments

Difference
mix(a, |a-b|, f)
Absolute value of the difference between base and blend layers

Divide
mix(a, a ÷ b, f)
Base layer is divided by the blend layer

Screen
1 - mix(1, 1-b, f)⋅(1-a)
Inverse of the base layer is multiplied by the blend layer

Subtract
mix(a, a-b, f)
Blend layer is subtracted from the base layer

Multiply
mix(a, a⋅b, f)
Base layer is multiplied by the blend layer

Add
mix(a, a+b, f)
Blend layer is added to the base layer

Mix
mix(a,b,f)
Linear interpolation between base and blend layers

[/TABLE]

Please feel free to post your corrections to formulas and descriptions so that we could have a complete and accurate list.

Same goes for the interpolation modes. Currently, documentation has lists like “Cardinal: Cardinal.”. Not very informative, is it? Please post your descriptions for those as well.

Here’s what I could put together for interpolation modes.

Interpolation modes:

  • Linear: Linear (default). A smooth, consistent transition between colors. *material from the Wiki
  • Ease: Ease by quadratic equation. *material from the Wiki
  • Cardinal: Smooth step using Cardinal curves. Unlike B-Spline, control point values are preserved.
  • B-Spline: Smooth step using B-Splines. Provides very soft transitions due to control point values smoothing.
  • Constant: Sharp step. Each control point sets the value that remains the same until the next control point is encountered.

I will edit this post with (hopefully) additions and corrections.

PS. Also, if someone could point me to this forum’s table editing guide, I’d be much obliged. Really want to get rid of these horrid borders in favor of more thin and clean ones :wink:

3 Likes

I have saved these image layer mode formulas a long time ago, perhaps these can help

multiply: ab
add: a+b
screen: 1-(1-a)
(1-b)
darken: min(a,b)
color burn: 1-(1-a)/b
subtract: a-b
divide: a/b
lighten: max(a,b)
color dodge: a/(1-b)
overlay:if a<=0.5: (2*a)*b

else 1-(1-2(a-0.5))*(1-b)

Edit: changed the color dodge formula to match what wikipedia says about it.

Burn appears to be (a - f⋅(b+1)) ÷ (1 - f⋅(b+1)) and dodge a ÷ (1 - f⋅b), both clamped to the 0-1 range, if I read the code right.
Linear light seems to be a + f ⋅ (2⋅b -1), and soft light was such a complex thing I doubt if the formula would help anyone (and I’m too lazy to type it)
As to what they do, I can’t explain better than the visual effects you get from using them.

Thanks, JA12 and hjaarnio! I’ve updated the table with your suggestions and the info I managed to dig up. Still descriptions need more work, and no meaningful one for the ‘Soft Light’ :frowning:

Also the interpolation types, I’m not sure I’ll be able to produce correct wording to describe B-Spline, and I don’t know much about Cardinal curves to be able to write about them. Anyone?

A small update with Soft Light blending mode and interpolation modes descriptions. Let me know what you think.

can we get samething for cycles different nodes modes

like formulas for mix shader node add shader node
color node modes …
ect.

hope to see this in wiki soon

thanks

happy cycles

This is not something specific to Blender Render only, RickyBlender. The blending modes (should) work the same be it BI texture blending mode, compositor or Cycles ColorRGB mix node. Mix shader does just that: Mix (like the formula in the above table, with ‘a’ being the top input, ‘b’ the bottom one and ‘f’ - the factor). In any case, this is a general list of all the modes used throughout Blender. Once I get all this sorted out and reviewed I’ll start adding this to wiki with appropriate links.

If you spot anything I missed, please point it out, I’ll do my best to fill in the gaps.

considering that in futur dont’ know when
normal blender renderer will be replaced by cycles
i would suggest you do it in function of cycles

i was looking for the mix node in cycles and finaly found it after a while

would have been nice to have this table in wiki!

for the last mix

may be show it like this

Output =x ⋅ ( 1 − f ) + y ⋅ f

f = fac
x =First input
Y= second input

thanks

RickyBlender, I don’t know why you think that Blender Render will ever be replaced by Cycles (it won’t). And again, I’m not tying this info to concrete render engine or node editor. This is really a generic info valid for every place where color mixing is involved. And yes, there definitely should be a note about what input means what.

As for editing the wiki, it turns out a lot larger task than I initially thought, and may take a while. But eventually, I’m sure all the info will be where it needs to be and how it needs to be, so no worries here :slight_smile:

that is the reason why cycles was brought up in the first place
in 2.5 i mean to replace internal renderer
there was not development done on internal renderer for last 2 years!
only cycles is being develop

so one day it will replace internal renderer
but agree it may take a long time before cycles is good enough to have all the old features!

happy cycles

Viewport rendering and freestyle doesn’t count?

lately there was these 2 features added
but this will later on be ported to cycles if possible

for time being i heard that freestyle cannot be ported to cycles
that’s why it was added to BL internal
but may be later on there will be a way to port it!

otherwise there was practicaly nothing done on the internal renderer!

most of dev times was spend on developing cycles!

the goal for cycles is to one day in the futur replace the internal renderer
mind you i don’t think it will happen in near futur !
and in any case i still like the old internal renderer because for noobies it is easier/learn to use then cycles using nodes set up
which is more abstract and difficult to learn and do things!
and rendering in internal blender is still way faster for the time being but this could change soon hopefully

will see what happen in futur with BL!

happy blendering