Jump to content
  • Advertisement

Archived

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

Temper

Single-pass texturing with Direct3D7

This topic is 6479 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''ve got a landscape. I''ve got 2 textures -- one "detail texture", the other eg. grass. Err.. forget ''bout the landscape, all I need to do is blend two textures together and add vertex based lighting on top of that. I can do that with 3 texture stages, but shouldn''t it be accomplished with only two of ''em? D3D does it "by default", doesn''t it: texture + lighting at stage 0? Yet all I''ve done has failed.. Testing this on Voodoo3, supporting the caps required. -- code alert -- VOID cTerrain::Render(LPDIRECT3DDEVICE7 pd3dDevice) { // (got textures set on stages 0 and 1) // the code goes something like this: pd3dDevice->SetTextureStageState(0, D3DTSS_TEXCOORDINDEX, 0); pd3dDevice->SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_SELECTARG1); pd3dDevice->SetTextureStageState(0, D3DTSS_COLORARG1, D3DTA_TEXTURE); pd3dDevice->SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_SELECTARG1); pd3dDevice->SetTextureStageState(0, D3DTSS_ALPHAARG1, D3DTA_DIFFUSE); pd3dDevice->SetTextureStageState(1, D3DTSS_TEXCOORDINDEX, 1); pd3dDevice->SetTextureStageState(1, D3DTSS_COLOROP, D3DTOP_MODULATE); pd3dDevice->SetTextureStageState(1, D3DTSS_COLORARG1, D3DTA_TEXTURE); pd3dDevice->SetTextureStageState(1, D3DTSS_COLORARG2, D3DTA_CURRENT); pd3dDevice->SetTextureStageState(1, D3DTSS_ALPHAARG1, D3DTA_DIFFUSE); pd3dDevice->SetTextureStageState(1, D3DTSS_ALPHAARG2, D3DTA_TEXTURE); pd3dDevice->SetTextureStageState(1, D3DTSS_ALPHAOP, D3DTOP_SELECTARG1); pd3dDevice->SetTextureStageState(2, D3DTSS_COLOROP, D3DTOP_MODULATE); pd3dDevice->SetTextureStageState(2, D3DTSS_COLORARG1, D3DTA_DIFFUSE); pd3dDevice->SetTextureStageState(2, D3DTSS_COLORARG2, D3DTA_CURRENT); pd3dDevice->SetTextureStageState(2, D3DTSS_ALPHAOP, D3DTOP_SELECTARG1); pd3dDevice->SetTextureStageState(2, D3DTSS_ALPHAARG1, D3DTA_DIFFUSE); pd3dDevice->DrawIndexedPrimitive( D3DPT_TRIANGLELIST, (D3DFVF_XYZ | D3DFVF_NORMAL | D3DFVF_TEX2), lpVertices, dwVertexCount, lpIndices, dwIndexCount, NULL ); } -- clips --

Share this post


Link to post
Share on other sites
Advertisement
I remember a similar question like this and I believe the solution was to blend the lighting color in the third texture stage. The reason why it could only be blended in the third stage was that the Voodoo cards can only blend iterated color at the end of the texture chain (because of the hardware design). So as an answer to your question: No, you can''t do it with only two texture stages on the Voodoo cards. You may be able to do it on other cards though, by modulating the first texture with the iterated color.

- WitchLord

Share this post


Link to post
Share on other sites
Thanks. Do you happen to know the dxcap (or more like lack of) "causing" this?

At the end of texture chain, eh? Ain''t the last stage always at the end?-) I mean you CAN do tex+lighting using only one texture stage, right? Blending in a second stage (or the first) shouldn''t dim down the lighting.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!