Original Post
Hi, im trying to get a deeper knowledge about lighting in d3d. from the SDK Documentation i know, that ambient lighting is computed by the following formula: Ambient Lighting = Ca*[Ga + sum(Atti*Spoti*Lai)] with Ca = Material ambient color Ga = E Global ambient color Atteni = Light attenuation of the ith light. Spoti = Spotlight factor of the ith light. Lai = Light ambient color of the ith light while im understanding Ca and Ga i dont understand excatly the sum. i will now write what I THINK about the last 3 variables. please correct me if im wrong or tell me if im right. 1) i think the sum is like a for-loop which iterates through all lights (spot, directional and point) in the scene. is this correct? 2) Atteni descripes the "power" of the light. if the vertex is out of the light range Atteni will be 0 for this light. this value is only used by spot and point lights. but what if ive got a directional light (the sun) in my scene? lets say that my third light is a directional light. does d3d then set Atten2 = 1? 3) Spoti is the "power" of the spotlight. this value is only used by spotlight. but again a similar question: what if light 2 is a point light? does d3d set Spoti = 1 for all non-spot lights? thanks for all answers!