PDA

View Full Version : Compositing math?


Mic_Ma
06-09-2006, 11:28 PM
I am no programmer but I need help with some shader-stuff. So, sorry if this may make no sense.


If for compositing layers "a" and "b" (sa, sb are constants):

a+b-a*b Screen
a * b Multiply
a + b Add
a - b Sub
a / b Divide
a + b - 2 * a *b Xor
min(a,b) Min
max(a,b) Max
abs(a-b) Difference


Then what would be the expressions for (like in Photoshop layer modes):

Hue
Color

bdx
06-10-2006, 08:01 AM
Then what would be the expressions for (like in Photoshop layer modes):
Hue
Color
The expressions for these are less simple. Assuming you have RGB input colors, convert them to HSV first (just google for the formulas). For Hue you then take the H component of b, and the S and V components of a, and convert that back to RGB. I'm not sure about Color since I don't have photoshop, but I'd say take H and S from b, and V from a.

Segmoria
06-11-2006, 10:09 PM
You might wanna have a look at this link for a very comprehensive guide to some more blending formulas:
http://www.pegtop.net/delphi/articles/blendmodes/

CGTalk Moderation
06-11-2006, 10:09 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.