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


Any one can give a sample on pixel light in DX?

Recommended Posts

I've got mad with the SetTextureStageState....I can understandpixel light's formula and theory,but what block me is the D3D's methods... Who can give a complete sample about Render passes(one pass can hold 2 texture stages) that implement diffuse(N.L) and specular(Color*(N.H)^p*atten,H=normalize(vLookDir+vLightPos))?(Assume m_TexNormal is the normalmap,m_TexBase is the base texture) Currently,Only my ambient light code can work correctly,as follow: {//Ambient m_D3DDevice.m_p->SetRenderState( D3DRS_TEXTUREFACTOR, 0xFFBBBBBB );//ambient color. m_D3DDevice.m_p->SetTextureStageState( 0, D3DTSS_COLORARG1, D3DTA_TFACTOR ); m_D3DDevice.m_p->SetTextureStageState( 1, D3DTSS_COLORARG1, D3DTA_TEXTURE ); m_D3DDevice.m_p->SetTextureStageState( 0, D3DTSS_COLOROP, D3DTOP_MODULATE ); m_D3DDevice.SetTexture(m_TexBase,0);//m_TexBase:base texture m_Panel.Render(); } Thanks in advance! We create world. [edited by - kimryo on April 29, 2003 6:07:44 AM]

Share this post

Link to post
Share on other sites