Original Post
Hi !
Just wondering how to setup the renderstates so my polygons take color from :
1: the diffuse color
2: if there is an texture present, the texture
3: if the polygon is hit by light, the light color
[edit]the problem is when a polygon is outside the range or not hit by a light, the color is taken from the ambient color. I want the color to be a mix of the ambient and diffuse color.[/edit]
this is my current renderstates:
SetRenderState(D3DRS_ALPHATESTENABLE, TRUE);
SetRenderState(D3DRS_ALPHAFUNC, D3DCMP_GREATEREQUAL);
SetRenderState(D3DRS_ALPHAREF, 1);
SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA);
SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);
SetRenderState(D3DRS_BLENDOP, D3DBLENDOP_ADD) ;
SetTextureStageState(0,D3DTSS_COLOROP,D3DTOP_MODULATE);
SetTextureStageState(0,D3DTSS_COLORARG1,D3DTA_TEXTURE);
SetTextureStageState(0,D3DTSS_COLORARG2,D3DTA_CURRENT);
SetTextureStageState(0,D3DTSS_ALPHAOP,D3DTOP_MODULATE);
SetTextureStageState(0,D3DTSS_ALPHAARG1,D3DTA_TEXTURE);
SetTextureStageState(0,D3DTSS_ALPHAARG2,D3DTA_DIFFUSE);
SetTextureStageState(0,D3DTSS_MAGFILTER, D3DTEXF_LINEAR);
SetTextureStageState(0,D3DTSS_MINFILTER, D3DTEXF_LINEAR);
SetTextureStageState(0,D3DTSS_ADDRESSU, D3DTADDRESS_MIRROR);
SetTextureStageState(0,D3DTSS_ADDRESSV, D3DTADDRESS_MIRROR);
SetRenderState(D3DRS_LIGHTING, true);
SetRenderState(D3DRS_AMBIENT,D3DCOLOR_XRGB(128,128,128));
Thanks!
[edited by - Locutus2 on June 19, 2002 4:18:09 PM]