Archived

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

Chaucer

dx8.1 pixel shader blend only alpha

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:

ps.1.3

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