How to add lighting to a 3D scene

I’m new at 3D and I’m understanding everything apart from shaders, are there any good guides on how to add lighting in shaders so a set of 3D meshes?

I want to learn not copy, I’m asking if there are any good guides or tutorials?

Search for “lighting shader” or similar on google. There’s a lot of different examples, that’s what I used to come up with the lighting class mentioned above.

Here’s one that seems like a reasonable starter:

In a nutshell, you want to use a shader which you pass a light position (and perhaps an eye position) to as uniforms. Then in the shader you calculate the amount of ambient light (dark background lighting), then diffuse light, which is how directly facing towards the light source the surface is, and finally specular light which is the lightsource reflecting off the surface into your eye to give highlights.

Specular and Diffuse lighting will be based on the angle of the surface or the “normal” of the surface. You’ll have to calculate this and probably store it as a vector in a vertex buffer. The extra for experts is bumpmapping where you define an extra texture that encodes the normals pixel by pixel so you can light at a higher resolution than your mesh to give the impression of a richer object.

You’ll also need some concept of the material, saying what colour it is, how reflective it is etc.

Thanks that helped a lot, I’m sort of starting to understand! Hopefully ill have it down in a week or so, thanks again.