Jump to content
  • Advertisement


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


problem with lightmaps

This topic is 6273 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 have a voodoo3 card, but I am having a problem using 2 textures which my card should be able to do, but it works with Reference Rasterizer. Here is the code:
// Red Material

D3DMATERIAL8 Material;
D3DUtil_InitMaterial( Material, 1.0f, 0.2f, 0.2f, 1.0f ); //rgba

g_pGameApp->m_pd3dDevice->SetMaterial( &Material );

// 1st part: white texture

g_pGameApp->m_pd3dDevice->SetTexture( 0, m_Texture);
g_pGameApp->m_pd3dDevice->SetTextureStageState(0, D3DTSS_TEXCOORDINDEX, 0);
g_pGameApp->m_pd3dDevice->SetTextureStageState(0, D3DTSS_COLORARG1, D3DTA_TEXTURE); 
g_pGameApp->m_pd3dDevice->SetTextureStageState(0, D3DTSS_COLORARG2, D3DTA_DIFFUSE); 
g_pGameApp->m_pd3dDevice->SetTextureStageState(0, D3DTSS_COLOROP,   D3DTOP_MODULATE);

// 2nd part: lightmap - white with dark circle in the center 

g_pGameApp->m_pd3dDevice->SetTexture(1, m_LightMap); 
g_pGameApp->m_pd3dDevice->SetTextureStageState(1, D3DTSS_TEXCOORDINDEX, 0 );
g_pGameApp->m_pd3dDevice->SetTextureStageState(1, D3DTSS_COLORARG1, D3DTA_TEXTURE); 
g_pGameApp->m_pd3dDevice->SetTextureStageState(1, D3DTSS_COLORARG2, D3DTA_CURRENT);
g_pGameApp->m_pd3dDevice->SetTextureStageState(1, D3DTSS_COLOROP,   D3DTOP_MODULATE);

g_pGameApp->m_pd3dDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, 0, 2);
The texture is a white texture, and the light map has a dark cirle in the middle, the problem is in the first part, using the modulate to combine the texture with the material. Since the texture is white, and the material red, I should get a resulting red texture with a darker area in the center from the light map. But what i get is a white texture with a darker center. When I turn on reference rasterizer, the texture then turns red. So I know the code is done properly. Also, If I just comment out the lightmap portion (2nd part), then modulation will work and will be red, so why doesnt it work when I turn on the lightmap portion? Why does it only do the first modulation of the texture with the material in reference rasterizer? Possibility Edited by - Possibility on June 13, 2001 2:09:22 PM

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!