One idea you'll run across with transparent textures is that of premultiplied
alpha. PMG files never used premultiplied alpha. Other formats vary. Texture
data can be stored however you want in memory, either unmultiplied or
premultiplied. So what's it mean? Here's the blending equation normally used
for transparency. The source, that is the transparent object, is blended with
the destination, the object behind it using the source's alpha value.
Premultiplied alpha means just that. The term alpha source times color source
is going to be the same every time this texture data is accessed. We can
premultiply the original color by the alpha, and store this new color in
memory. This new equation saves a multiplication every single time this text
cell is accessed. Say we access this texture 60 times a second and a million
text cells are accessed. That saves 60 million multiplies a second, which could
start to add up.
透明設定には
プリマルチプライ済みアルファという考え方があります
PNGでは使えませんが他のフォーマットで使えます
状態に関わらずテクスチャのデータは
メモリに保存されます
これは一般的に透明設定で使われる式です
Sで示された透明オブジェクトが
ブレンディングされるのは
Dで示されたブレンディング先のオブジェクトです
CPがプリマルチプライ済みアルファです
αSと色を示すCSの積はテクスチャデータに
接続する度に変わることはありません
αSとCSの積をCPとしてメモリ上に保存します
この新たな式を使えば
テクセルに接続する度にCPの計算は必要ありません
例えばこのテクスチャに1秒に60回
100万テクセルに対して接続がある場合
1秒に6000万回分の掛け算をしなくても済みます