SetTextureStageState

Started by
1 comment, last by SiliconMunky 20 years, 5 months ago
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.
Advertisement
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).
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.

This topic is closed to new replies.

Advertisement