This topic is now archived and is closed to further replies.

dx8.1 pixel shader blend only alpha

This topic is 5273 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I''m currently using directx8.1 and ps1.3. I''m able to blend 2 textures using the following shader: ps.1.3 tex t0 tex t1 mul r1, t0, v0.rgb mad r0, t1, v0.rgb, r1 using this fvf: struct VERTEX { D3DXVECTOR3 position; D3DCOLOR diffuse; float tu, tv; float tu2, tv2; float tu3, tv3; }; #define D3DFVF_VERTEX (D3DFVF_XYZ|D3DFVF_DIFFUSE|D3DFVF_TEX3) where v0 is my diffuse and rgb and alpha each contain a weighted value for how much to blend. My problem is that, as you can see, I''m not using the alpha weight. isntead I use rgb for both. This works fine until i comment out the part in my code where i add the weight to the alpha component. If there is no alpha, then there is no blending. Is this the correct behavior? Shouldn''t I be able to blend on just the rgb component? Thanks.

Share this post

Link to post
Share on other sites
My textures don''t have an alpha channel so I''m using vertex alpha. My shader code, with comments, is this:


tex t0 //texture 1
tex t1 //texture 2

//multiply texture1 by weight1 (diffuse rgb value)
mul r1, t0, v0.rgb

//multiply texture2 by weight1 (diffuse rgb value) and add to current
mad r0, t1, v0.rgb, r1

Share this post

Link to post
Share on other sites