Advertisement

problem with lightmaps

Started by June 13, 2001 12:59 PM
-1 comments, last by Possibility 23 years, 8 months ago
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 );
g_pGameApp->m_pd3dDevice->SetRenderState(D3DRS_DIFFUSEMATERIALSOURCE, D3DMCS_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

This topic is closed to new replies.

Advertisement