I guess you didn't notice, but the previous examples didn't have any light. That's because, by default, lightning is disabled because it helps to make fast tests. But the they will come when you will want to use lightning, isn't it?. Using lights is very ease, but you must understand how they behave on the engine.
Lights are not objects, because you can't see them, you just see the light reflected on objects. That's why you can't add lights to the node hierarchy. Another thing you should node is that each camera can have a different set of lights. Remember how we added the nodes to the scene of a camera? that nodes could be on a camera's scene and not on another, right? The same happens with the lights.
Ok, I'm going to stop boring you and lets do an example with lights. The first thing we have to do is to create some lights. There are three types of lights: point lights, directinal lights and spotlights (as in most engines). Here we are going to use point lights because are the simplest. Point lights are like a light bulb and only affect a specific radius:
SDE.Graphic.ILight light1 = gMan.CreatePointLight();
SDE.Graphic.ILight light2 = gMan.CreatePointLight();
light1.Position = new Vector3(-1,0,-3);
light2.Position = new Vector3(1,0,-3);
billboard.Material.Lighting = true;
We are going to remove the teapots of the code, they were fine for the first example but now are useles, but let's keep the billboard. Lighting must be set true on billboard's material. Right now, the scene looks like this:
Ok, that looks fine but, how do we now we've got two different lights? Let's change light's color:
light1.Diffuse = System.Drawing.Color.Red;
light2.Diffuse = System.Drawing.Color.Cyan;
One thing you should know is that only 8 lights can be active at once. That's not a problem of the engine, but the hardware. You can increase the number of lights using pixel shaders. The engine activates the 8 closest lights to the camera.
Lights are very simple, arent they? The real thing begins on the next tutorial.