Why doesn't the ambient color work?

Started by
2 comments, last by cdoubleplusgood 10 years, 4 months ago

pDevice->SetRenderState(D3DRS_AMBIENT, D3DXCOLOR(0x00202020));

I use that state,and set the material's ambient value(argb) to 1.Yet all my vertices are still black(and yes i enabled lighting).

What could be the problem?

Advertisement

Do your vertices contain normals? You need normals for lighting (even though ambient lighting technically doesn't use them).

Another thought - I'm not using the fixed pipeline so I'm not sure this matter at all, but maybe you could try to use 0xFF202020 instead of 0x00202020. In fact for testing I would suggest rather something like 0xFFFF7F7F (you'll know it's working properly when your objects are rendered in red).

i have normals,and with 0xFFFF7F7F its still black

(deleted)

This topic is closed to new replies.

Advertisement