When we are preparing to create a virtual 3D world using any graphic rendering API such as OpenGL or DirectX, the role of the lights in that virtual environment need to be thought very carefully. It is very clear that only to determine the 3D objects, their positions, colors and textures is not enough to get the realistic 3D environment. In this article, I want to talk about some ideas and concepts of lights in OpenGL graphic API (application programming interface).
When we consider the lights in virtual 3D world, we will consider about the light that hits and affects the objects in 3D scene. We do not think only for the light itself. We have to think how it will “affect” the objects in 3D world.
The first light we have to think in virtual 3D world is ambient light. Ambient light can come to the object from anywhere and any place. Therefore, we can't determine the exact position and direction of the light. It is also impossible to determine where and in which direction the ambient light will hit the object. The ambient light is also from the surrounding objects in environment. When the ambient light hit the object, it spreads out to all directions equally. An example of the ambient light is light in normal room.
Another light in OpenGL is diffuse light. Diffuse light has particular direction but when it hits the object, it spreads out to all directions. The light itself has specific direction. However, it will spread out to all directions equally when it hits the 3D object. Therefore, the strength of the light intensity for the viewer will not change according to the position of the viewer (eye). The exact position where the light will hit on the surface of the object depends on the position of the light but the feeling for the hitting of light on that position of the surface of the object is the same from wherever the eye position is. It will not change according to the eye point's position.
Specular light is the light that reflects form the object after a light has hit it. In real world substance such as steel and metal have high specular component. Some objects such as cloth, wool have little specular component or specular properties. Specular light depends on both the direction of the light and the specularity of the object. The feeling of the viewer upon the specular light also depends on the position of the eye. The reason is that it depends on the direction and position of the light.
The final type of light in OpenGL is emissive light. As the name implies, the light will be emitted form the objects. The object will have emissive color value in its properties and it will determine the color and intensity of the emissive light from it. One thing to note is that the emissive light from an object will not affect the environment and other objects in 3D world. It is the light that lit up only the object itself.
To determine the overall effect of lights for an object in virtual 3D world, we have to consider all the properties of the above lights for every object plus the object's color values and normal vectors.
OpenGL can supports up to eight light sources in one 3D scene. When the lights are created in OpenGL, we have to consider the their positions, directions (if they have) and the colors of the light sources. We also need to consider the specularity properties of the object, the color of the surface of that object and how the object might react the lights that hit upon it.
Without considering all of the above faces, we will not get the complete and realistic virtual 3D world with lights effects.
When we consider the lights in virtual 3D world, we will consider about the light that hits and affects the objects in 3D scene. We do not think only for the light itself. We have to think how it will “affect” the objects in 3D world.
The first light we have to think in virtual 3D world is ambient light. Ambient light can come to the object from anywhere and any place. Therefore, we can't determine the exact position and direction of the light. It is also impossible to determine where and in which direction the ambient light will hit the object. The ambient light is also from the surrounding objects in environment. When the ambient light hit the object, it spreads out to all directions equally. An example of the ambient light is light in normal room.
Another light in OpenGL is diffuse light. Diffuse light has particular direction but when it hits the object, it spreads out to all directions. The light itself has specific direction. However, it will spread out to all directions equally when it hits the 3D object. Therefore, the strength of the light intensity for the viewer will not change according to the position of the viewer (eye). The exact position where the light will hit on the surface of the object depends on the position of the light but the feeling for the hitting of light on that position of the surface of the object is the same from wherever the eye position is. It will not change according to the eye point's position.
Specular light is the light that reflects form the object after a light has hit it. In real world substance such as steel and metal have high specular component. Some objects such as cloth, wool have little specular component or specular properties. Specular light depends on both the direction of the light and the specularity of the object. The feeling of the viewer upon the specular light also depends on the position of the eye. The reason is that it depends on the direction and position of the light.
The final type of light in OpenGL is emissive light. As the name implies, the light will be emitted form the objects. The object will have emissive color value in its properties and it will determine the color and intensity of the emissive light from it. One thing to note is that the emissive light from an object will not affect the environment and other objects in 3D world. It is the light that lit up only the object itself.
To determine the overall effect of lights for an object in virtual 3D world, we have to consider all the properties of the above lights for every object plus the object's color values and normal vectors.
OpenGL can supports up to eight light sources in one 3D scene. When the lights are created in OpenGL, we have to consider the their positions, directions (if they have) and the colors of the light sources. We also need to consider the specularity properties of the object, the color of the surface of that object and how the object might react the lights that hit upon it.
Without considering all of the above faces, we will not get the complete and realistic virtual 3D world with lights effects.
No comments:
Post a Comment