How can i have multiple diffuse lights ?
i don’t want to have any ambient lighting , just 6 diffuse lights around my 3D object , turning around its Y axis .
How is this possible ?
Thanks
How can i have multiple diffuse lights ?
i don’t want to have any ambient lighting , just 6 diffuse lights around my 3D object , turning around its Y axis .
How is this possible ?
Thanks
Lighting is additive, so you can calculate the lighting for each light separately, then add up the lighting calculations.
Legacy OpenGL (fixed-function) or modern (shaders)?
For the fixed-function pipeline, you just enable multiple lights (GL_LIGHT1
, GL_LIGHT2
, etc) and configure them (the first parameter to glLight
is the light which is affected).
For shaders, store the light data in a uniform array and iterate over the lights in a loop.
thanks for the answer ,
i am using the Modern using shaders and i did as you said .
adding multiple uniforms to the fragment shader and sending different diffuse lights setting to different directions to those uniforms .