//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.
SetTextureStageState
Ok, i just got multi-texturing working with my terrain, but to get the fixed function lighting to work i had do do this:
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).
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement