Game Development Reference
In-Depth Information
This script rotates the directional light around its local x axis. Since the directional light
emits in the positive direction of its local z axis, the rotation changes the angle between the
emitted light beam and the horizon. This gives an effect similar to sunrise and sunset (for
better understanding of this rotation, use the left-hand rule, rotate your hand around the
middle finger, and see how the direction of your index changes). The speed used here is a
little bit higher than the speed of camera movement, because we want to see the effect light
rotation before the camera goes far away from scene elements.
In this chapter we have learned how to construct a simple scene using basic shapes with differ-
ent positions, rotations and scales. We have also learned how to use 2D images as textures
to give details to the shapes. We have introduced different types of lighting sources and dis-
cussed their interesting properties. We have also written some scripts that change the prop-
erties of the objects during game execution.
Notice that there are more advanced topics regarding scene construction that were not
covered in this chapter. The aim of this chapter was to provide a quick introduction to scene
construction, so that we understand the structure of the scene and be able to interact with it.
This was important because interaction is a core element in game development. There will
be more on textures, materials, lighting, and shaders in the coming chapters.
Exercises
1. We've discussed the use of basic shapes to construct a scene. Use them to con-
struct a more complex scene. For example, draw a house with a garden surrounded
by a wall. You can look up in the internet for free textures to use.
2. Add point lights to the scene you have constructed in exercise 1. Select
appropriate positions for these lights, and adjust their properties to make a night scene
with electric lights. Remember to choose a dark color for the ambient light.
3. Modify CameraMover script to make the camera rotate around the scene hori-
zontally, while keeps looking at the center of the scene. Axes of local space can help
you to achieve this behavior. Add the modified version to the camera in the scene
you have constructed in exercise 1.
4. Try to make use of relations between objects to add a spot light to the camera.
This spot light must move along with the camera and focus on the position where
the camera looks.
Search WWH ::




Custom Search