Hi all
I'm trying to blend 4 textures into one and then save the resulting texture in a new bitmap.
Some more detail:
I have 4 textures, Layer0 - Layer3 and 3 alphamaps, Alpha1 - Alpha3
The blending basically works like this:
Color = ((Layer0 * (1 - Alpha1) + Layer1 * Alpha1) * (1 - Alpha2) + Layer2 * Alpha2) * (1 - Alpha3) + Layer3 * Alpha3
Or (in sequence):
Color = Layer0
Color = Color * (1 - Alpha1) + Layer1 * Alpha1
Color = Color * (1 - Alpha2) + Layer2 * Alpha2
Color = Color * (1 - Alpha3) + Layer3 * Alpha3
All textures have the same size (2048x2048) and are bitmaps that I have in memory.
I currently combine them by doing an iteration over all pixels and calculating the values. This takes 10 seconds (which is NOT acceptable).
Can I do this using DirectX and then save the result? I need the result as a bitmap that I can save again, so having it only on the graphic card is not sufficient.
Cheers
Remo