0% found this document useful (0 votes)
105 views

Assignment of Computer Graphics: Topic: Lighting and Its Effects

The document discusses various concepts related to lighting in computer graphics including: - Lighting involves assigning colors to vertices based on their position and orientation relative to lights. - Normals must be transformed and renormalized when applying non-rigid transformations to properly compute lighting. - Materials have an inherent color and reflect a portion of incident light, while lights have an intensity but no upper limit. - Reflection is modeled as diffuse, reflecting light uniformly, or specular, reflecting in a single direction like a mirror. Real materials exhibit a mixture of these behaviors.
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
105 views

Assignment of Computer Graphics: Topic: Lighting and Its Effects

The document discusses various concepts related to lighting in computer graphics including: - Lighting involves assigning colors to vertices based on their position and orientation relative to lights. - Normals must be transformed and renormalized when applying non-rigid transformations to properly compute lighting. - Materials have an inherent color and reflect a portion of incident light, while lights have an intensity but no upper limit. - Reflection is modeled as diffuse, reflecting light uniformly, or specular, reflecting in a single direction like a mirror. Real materials exhibit a mixture of these behaviors.
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 4

Assignment of Computer Graphics

Topic: Lighting and its effects Name: Syed Muhammad Junaid Hassan Roll No: 29 Class: BSIT 8th semester

Transform, Clip, Scan Convert : The transformation, clipping/culling, and scan conversion processes provide us a way to take a 3D object defined in its object space and generate a 2D image of pixels. If each vertex has a color, that color gets smoothly interpolated across the triangle giving us a way to generate full color images. Lighting is essentially the process of automatically assigning colors to the vertices based on their position/orientation in the world relative to lights and other objects. Lighting : Each vertex goes through a lighting process which determines its final color. This color value is then interpolated across the triangle in the scan conversion process. Usually, each vertex has some sort of initial color assigned to it, which defines what color it would be if well lit by a uniform white light. This initial color is then modified based on the position and normal of the vertex in relation to lights placed in the scene (in other words, a grey vertex dimly lit by red lights will appear dark red). Normal Transformations : Lighting requires accurate measurement of distances and angles, so we want to compute lighting in a regular 3D space. This leaves object space, world space, or camera space as our most natural options. To light in object space, we would have to transform the lights from world space into each objects space. If we are applying shears or non-uniform scales to our object, this will distort the object which will mean that object space isnt actually a legitimate place to do lighting. Lighting in world space would be fine, but it would require transforming the object into world space, which is a step that we usually avoid explicitly doing. Therefore, it makes good sense to light in camera space, as we will probably want to perform clipping & some culling in this space as well. GL does its lighting in camera space, which means that we must transform normals into camera space in addition to the vertex positions. Remember that when we transform a normal, we dont want to apply the translation portion of the matrix. Lets say we take the 3 vertices of a triangle and compute the normal, then we transform the 3 vertices and the normal. If the transformation contains any shear or non-uniform scaling, then it is possible that the transformed normal will no longer be perpendicular to the transformed triangle itself. To fix this, we should actually transform the normal by the inverse transpose of the matrix. The transformed normals will also not be unit length any more, so they must also be renormalized before lighting. In other words, if we have non-rigid transformations, we need to compute a matrix inverse once, and then renormalize every normal to properly transform the normals. This is expensive, so should only be done when necessary. The good news is that most of the time, we tend to use rigid transformations in computer graphics (transformations that are built up purely from rotations and translations) and for a rigid matrix. Another good piece of news is that we only need to transform the normals in to world or camera space, and dont need to project them or compute a perspective division. Lighting : Whether we are computing lighting per vertex or lighting per pixel, the basic process is the same. In either case, we are computing the lighting at some position v with some normal n. Material Colors : Objects have an inherent material color which is the color that the object reflects. The material gets its color because the reflectivity varies with the wavelength of light. In CG, we usually dont represent color as a continuous spectrum. Instead, we just represent it is a combination of red, green, and blue. Obviously, an object cant reflect more light than it receives, so at best, it could reflect 100% of the light in all wavelengths (thus appearing bright white). A more realistic white object might reflect perhaps 95% of the light, so we would say that its actual material color is (0.95, 0.95, 0.95). We will assume that material colors are limited from 0.0 to 1.0 in red, green, and blue (or more realistically from 0.0 to 0.98 or so).

Light Color : However, if we are looking at a white piece of paper under uniform light, we can always turn more lights on, and get more light to reflect off of the paper. There is no upper limit to the intensity of light. If we want to represent a light intensity (light color), we can store it as red, green, and blue values ranging from 0.0 to an arbitrarily high value. In other words, a bright white light bulb might have an color of (10, 10, 10). Color & Intensity : We need to make a distinction between material color and light color. Material colors represent the proportion of light reflected. Light colors represent the actual intensity of a beam of light. We never actually perceive the inherent material color, all we see is the light reflected off of a material. If we shine a red light on a grey surface, the object appears dark red because it is reflecting beams of dark red light. Exposure : The monitor has an upper limit to the brightness it can display. If light intensity has no upper limit, then how do we determine what the value of white is? This relates to the issue of white balance and exposure control. The human eye (and digital cameras) will adjust their internal exposure settings to normalize the appearance of white. In other words, if we are in a moderately lit room, the light color (0.5, 0.5, 0.5) might appear as white, but when we go outside, our eye adjusts its exposure so that (10, 10, 10) looks white. Ideally, we would have some sort of virtual exposure control. There are various advanced rendering techniques that handle the issues of color and exposure in fairly complex ways. For today, we will just assume that a light intensity of (1,1,1) is white, and any light intensity values above 1.0 will simply get clamped to 1.0 before storing the color in the actual pixel. Reflectivity : A white sheet of paper might reflect 95% of the light that shines on it. An average mirror might reflect 95% of the light that shines on it. Yet, these two things look completely different, because they reflect light in different directions. We say that the paper is a diffuse reflector, whereas the mirror is a specular reflector. Diffuse Reflection : An ideal diffuse reflector will receive light from some direction and bounce it uniformly in all directions. Diffuse materials have a dull or matte appearance. In the real world, materials will not match this behavior perfectly, but might come reasonably close. Specular Reflection : An ideal specular reflector (mirror) will bounce an incoming light ray in a single direction, where the angle of incidence equals the angle of reflection. Specular (Glossy) Reflection : Sometimes, a material behaves in a specular way, but not quite perfect like a mirror (like an unpolished metal surface). In CG, this is sometimes referred to as glossy reflection. Glossy materials look shiny and will show specular highlights. Diffuse/Specular Reflection : Many materials have a mixture of diffuse and specular behavior. Plastics are a common example of this, as they tend to have an overall diffuse behavior, but still will catch highlights. Real Reflector : Materials in the real world might have fairly complex reflection distributions that vary based on the angle on the incoming light. Modeling these properties correctly is a very important part of

photoreal rendering, and we will talk more about this in later lectures. For today, we will allow materials to have a mixture of ideal diffuse and glossy properties. Diffuse Reflection : At first, we will consider a purely diffuse surface that reflects light equally in all directions. The light reflected is proportional to the incident light (the material color determines the proportion). Lets assume we have a beam of parallel light rays shining on the surface. The area of the surface covered by the beam will vary based on the angle between the incident beam and the surface normal. The larger this area, the less incident light per area. In other words, the object will appear darker as the normal turns away from the light. We see that the incident light (and thus the reflected light) is proportional to the cosine of the angle between the normal and the light rays. This is known as Lamberts cosine law, and ideal diffuse reflectors are sometimes called Lambertian reflectors. Directional Light : When light is coming from a distant source (like the sun), the light rays are parallel and assumed to be of uniform intensity distributed over a large area. Point Lights : For closer light sources, such as light bulbs, we cant simply use a direction. A simple way to model a local light source is as a point light that radiates light in all directions equally. In the real world, the intensity from a point light source drops off proportionally to the inverse square of the distance from the light. Incident Light : To compute a particular lights contribution to the total vertex/pixel color, we start by computing the color of the incident light. The incident light color represents the actual light reaching the surface in question. For a point light, for example, the actual incident light is going to be the color of the source, but will be attenuated based on the inverse square law. We also need to know the incident light direction. This is represented by the unit length vector. Computing the incident light color & direction is pretty straightforward, but will vary from light type to light type. Multiple Lights : Light behaves in a purely additive way, so as we add more lights to the scene, we can simply add up the total light contribution. In some very specific cases, light can interfere with other light and effectively behave in a subtractive way as well, but this is limited to very special cases. Ambient Light : In the real world, light gets bounced all around the environment and may shine on a surface from every direction. Modeling accurate light bouncing is the goal of photoreal rendering, but this is very complex and expensive to compute. A much simpler way to model all of the background reflected light is to assume that it is just some constant color shining from every direction equally. This is referred to as ambient light.

You might also like