Lights and shadows are very important techniques for producing a great presentation. Proper scene lighting sets the mood and also adds depth to an otherwise flat-looking scene, while shadows add more realism, and more importantly, root the shadow-casting objects to the ground, destroying the impression of models floating in mid-air.
This recipe will show you how to add lights to your game scenes and make objects cast shadows to boost your visuals.
You need to create the setup presented in Setting up the game structure found in Chapter 1, Setting Up Panda3D and Configuring Development Tools before proceeding, as this recipe continues and builds upon this base code.