Skip to main content
5 votes
Accepted

How do I add two color values containing alpha?

First, you have to consider what having an alpha value less than one means. You can consider an RGBA colour like $(1,0,0,0.5)$ as "a red object that is 50% transparent"; but an equivalent ...
gilgamec's user avatar
  • 901
5 votes

How to perform additive blending in Metal. What do these terms mean?

The “blend factors” are the amount that the specified component is multiplied by while blending. “Destination” is the existing content that’s being blended “on top of”, while “source” is the new ...
Noah Witherspoon's user avatar
3 votes
Accepted

Avoid having an opaque and transparent variant of each pixel shader

You can use a threshold set through a constant buffer to clip pixels (ie an alpha test): ...
Nathan Reed's user avatar
2 votes

How do I add two color values containing alpha?

Well, its not as defined as you would like it to be. There is no definitive answers to this. It really depends on what you model with alpha and RGB values. Generally we can model one of 2 things with ...
joojaa's user avatar
  • 8,437
1 vote

Why is it so important to minimize alpha in textures for rendering

I would say the reason for reducing cases of alpha blending (or testing) has less to do with the cost of the actual read-modify-write but more to do with increasing the use of early Z testing that's ...
Simon F's user avatar
  • 4,241
1 vote

How do I add two color values containing alpha?

If by adding two colour values with alpha you mean to combine them for the purposes of blending then here's the answer you need. I'll show the full derivation too. Feel free to scroll down to the TL;...
Wyck's user avatar
  • 410
1 vote
Accepted

In alpha premultiplied sRGB a color component can't be greater than the alpha, right?

As it turned out, the premultiplied color data was transformed to sRGB. Alpha stays linear. In that case, a component can be greater than the alpha. For example, with alpha 0.5 and color 1.0, the ...
nikitablack's user avatar
1 vote
Accepted

Repeating alpha over/under operation multiple times

So taking source over as an example, the math works out to: dst = a * src + (1 - a) * dst Taking Nathan Reed's suggestion of replacing (1 - a) with ...
user1118321's user avatar
  • 3,411
1 vote

How to perform additive blending in Metal. What do these terms mean?

Terminology The source color is the value written by the fragment/pixel shader. The destination color is the color from the image currently in the frame buffer (that will be overridden). Additive ...
Matthias's user avatar
  • 1,074
1 vote

Make Object created in a list blend in/dissolve out of a scene

It looks like there are a few steps to make this work: Linearly interpolate the alpha of the mesh from transparent to fully opaque, or vice versa. Note 1: It seems as if the alpha starts to fade a ...
clabe45's user avatar
  • 163

Only top scored, non community-wiki answers of a minimum length are eligible