#### Archived

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

# SetTextureStageState

This topic is 5197 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Ok, i just got multi-texturing working with my terrain, but to get the fixed function lighting to work i had do do this:
//set the multitexture states
mlpD3DDevice->SetTextureStageState(0,D3DTSS_COLORARG1,D3DTA_TEXTURE);
mlpD3DDevice->SetTextureStageState(0,D3DTSS_COLORARG2,D3DTA_DIFFUSE);
mlpD3DDevice->SetTextureStageState(0,D3DTSS_COLOROP,D3DTOP_MODULATE);

my question is, why does D3DTA_DIFFUSE also add the ambient component and not just the diffuse component of the vertex? the sdk says D3DTA_DIFFUSE The texture argument is the diffuse color interpolated from vertex components during Gouraud shading. If the vertex does not contain a diffuse color, the default color is 0xFFFFFFFF. Permissions are read-only.

##### Share on other sites
The ambient term is calculated into the "diffuse" output color of the vertex (oD0 in a vertex shader). Adding the ambient is not a per-pixel operation (and it doesn''t need to be).

##### Share on other sites
Thanks, I kind of figured they were thrown in together. Though i thin it''s still funny then that a vertex''s color is seperated between ambient and diffuse.