• Advertisement

Archived

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

texture blending loses lighting on all but 1st stage

This topic is 5064 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 doing texture blending, and i got it working with theses texture stages:
d3dDevice->SetTexture(0, tex1);
d3dDevice->SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_SELECTARG1);
d3dDevice->SetTextureStageState(0, D3DTSS_COLORARG1, D3DTA_TEXTURE);
d3dDevice->SetTexture(1, tex2);
d3dDevice->SetTextureStageState(1, D3DTSS_COLOROP, D3DTOP_BLENDDIFFUSEALPHA);
d3dDevice->SetTextureStageState(1, D3DTSS_COLORARG1, D3DTA_TEXTURE);
d3dDevice->SetTextureStageState(1, D3DTSS_COLORARG2, D3DTA_CURRENT);
then i noticed that my lighting had dissappeared. i can get it back for the first texture, but not for the second one using these texture stages:
d3dDevice->SetTexture(0, tex1);
d3dDevice->SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_MODULATE);
d3dDevice->SetTextureStageState(0, D3DTSS_COLORARG1, D3DTA_TEXTURE);
d3dDevice->SetTextureStageState(0, D3DTSS_COLORARG2, D3DTA_CURRENT);
d3dDevice->SetTexture(1, tex2);
d3dDevice->SetTextureStageState(1, D3DTSS_COLOROP, D3DTOP_BLENDDIFFUSEALPHA);
d3dDevice->SetTextureStageState(1, D3DTSS_COLORARG1, D3DTA_TEXTURE);
d3dDevice->SetTextureStageState(1, D3DTSS_COLORARG2, D3DTA_CURRENT);
how do i get lighting to work on my second texture, too? [edited by - MadProgrammer on April 14, 2004 5:37:35 PM] [edited by - MadProgrammer on April 14, 2004 5:39:37 PM]

Share this post


Link to post
Share on other sites
Advertisement
In stage 0, lighting happens to be in D3DTA_CURRENT. In all stages though, you can get at the lighting information via D3DTA_DIFFUSE.

Simply blend the two textures like your first example, then in stage 2 modulate(2x|4x) diffuse with current.

Share this post


Link to post
Share on other sites
Ok, your sample only showed blending with stage 0 and 1, not stage2.

I''ll explain this slowly for you.

M o d u l a t e b y d i f f u s e a f t e r y o u '' v e d o n e e v e r y t h i n g e l s e.

Share this post


Link to post
Share on other sites
oh, i get it now! i though u were saying mess with the 2nd texture stage (stage 1), but u were saying add another stage.

well, it works now, so thanks :-)

matt

Share this post


Link to post
Share on other sites

  • Advertisement