Thread: Sweet
View Single Post
Old 5th October 2005, 05:44   #42
Milkdrop Moderator
Join Date: Oct 2004
Posts: 114
@eos - i'll look into that texture thing, i just dont know how to flip them around, or blend them
flipping the image is simply a matter of changing the texture coordinates when you read from the texture [you'll want to work in pixel shader support, refer to msdn for info on this, I don't know much about specific device render calls etc. But I can provide HLSL and shader microcode all day long].

For horizontal flip, the x texture coordinate simply becomes 1-x, for vertical, the y coordinate becomes 1-y.

If you implement pixel shaders, then the blending is easily done by having the pixel shader read the texture forward, and flipped, and then giving an equation to combine them
(a+b)/2 averaged together
1-(1-a)*(1-b) inverse multiply, adds the images together, but the result never goes above 1
abs(a-b) images "invert" each other
a*(1/(1-b)) equivalent to the "color dodge" layer mode in photoshop

otherwise you have to use silly alphablending crap that requires getting shit like srcblend and destination blend modes set correctly, very annoying and way slower than just reading a texture twice or more, compositing the results, and then drawing that to screen once.
Eo.S. is offline   Reply With Quote