quote:Original post by dragon9
Thank you for your help S1CA. Your approach works well but I am experiencing an effect where the new grayscale textures are blended through as an alpha value. That is, a texture that was previously green is now gray, and thus about 50% transparent. How do I convert to grayscale without changing the alpha value in the original texture?
Ah yes!, I probably should have mentioned that the DOTPRODUCT3 operation copies the result into R, G, B **AND** A.
I assume this is only on polygons which are already translucent anyway - for opaque polygons, the contents of the alpha channel shouldn''t be an issue since you should have D3DRS_ALPHABLENDENABLE=FALSE
Although not always recommended, try closing off the alpha blending pipe a stage earlier than the colour pipe is closed.
i.e.
SetTSS( 1, D3DTSS_ALPHAOP, D3DTOP_DISABLE );
SetTSS( 2, D3DTSS_COLOROP, D3DTOP_DISABLE );
Alternatives if that gives you problems:
1) use an extra stage to restore the alpha to just the texture alpha (assuming you never need to do anything like an ADD with it and the hardware supports it.)
2) if you only need one colour input for whatever you''re doing in stage 0, then you could put the DOTPRODUCT in that stage and use the alpha in stage 1 to restore the alpha. [same idea as #1, but supported on many more chips]
*sigh* if only everyone in the world had pixel shader capable hardware - we could simply apply a write mask to the dp operation. One day...
--
Simon O''Connor
Creative Asylum Ltd
www.creative-asylum.com