StudentShare
Contact Us
Sign In / Sign Up for FREE
Search
Go to advanced search...
Free

OpenGL Lighting and Shading - Essay Example

Cite this document
Summary
"OpenGL Lighting and Shading" paper focuses on OpenGL which was first released in 1992 and has been adopted as the graphics API for real-time interactive 3D graphics. The software is procedural other than a descriptive interface. This means that the programmer has to specify appropriate commands. …
Download full paper File format: .doc, available for editing
GRAB THE BEST PAPER97.6% of users find it useful
OpenGL Lighting and Shading
Read Text Preview

Extract of sample "OpenGL Lighting and Shading"

? Report: OpenGL Lighting and Shading OpenGL Lighting and Shading Introduction OpenGL was first released in 1992 and has been adopted as the graphics API for real-time interactive 3D graphics. The software is procedural other than a descriptive interface. This means that the programmer has to specify appropriate commands. The commands set up the camera view and modeling transformations as well as drawing the geometry in case it is a sphere with the desired color (Addison-Wesley Publishing Company, 1997). Aspects of OpenGL This procedural interface has a demerit in that the application must be specific on all operations in details and the correct sequence. However it has a merit in that the processes involved in generating images are flexible. It is more or less like a graphics assembly language whereby there is the possibility of combining the pieces of the software’s functionality as building blocks to create innovative graphics. Another aspect of the software is that its specifications are not pixel exact. There are high possibilities of two OpenGL unlikely rendering the same graphics. As a result, the software can be implemented in a range of hardware platforms. Exact specifications would limit hardware acceleration, and further its standard applicability. In the single implementation, lack of pixel exactness persists. The divergent paths through implementation generate different fragments. Despite this, the specifications do not allow for a set of invariance rules guarantee repeatable actions in various circumstances. Features in OpenGL Features existing in OpenGL are Lighting, Shading, Material and Texture Mapping. This paper will limit its discussion to Lighting and Shading in the programming perspective. Lighting Since light is a science and an art, there are many techniques of creating magnificent light in computer graphics. Through the design of OpenGL software, the lighting system approximates light behavior in a simple and efficient fashion. It fits best for computer games since it is possible to render light in real-time. Its lighting does not calculate reflections and scattering of light. At the same time, no shadows are produced. Lighting effects are achieved through textures, shadow mapping and shaders. Practically, light is present everywhere as objects too, react differently in the presence of light. Since light works with materials and has impact when a surface reflects it, OpenGL optimizes on this. Through its functions, it can define the characteristics of surfaces. The definitions focus on; what is the color of the surface now? And how much or little light does the surface reflect? These material properties describe surface. The software applies default material values until the programmer specifies his or her own settings. The following are the lighting effects supported by OpenGL; directional, Spot, Ambient lights and attenuation. Lighting in OpenGL is defined by the Lighting and Shading models. Before any setting is done, lighting mode is enabled since it requires enabling of the depth buffer. The glEnable is a function that enables several features in OpenGL and one of the features is lighting. This feature becomes the input parameter but still light will be required. Since the software has a direct support for approximately 8 lights, a light has to be enabled through a call. A disabling function is also available to disable unwanted light functions during programming. During programming, there are two types of light properties to be considered; one that describes a light source and the other that describes light reflected by the material of an object’s surface. This is specified by the function glLightfv. The light attenuation feature is responsible for reducing light intensity in relation to distance. It states the real-world policy that light intensity decreases with distance. During the operation, the position of the source of light must be specified (Ahmed, 2009 pp.1-2). Shading In the shading model, the function call glShadeModel is used for smooth or flat models. Gouraud-shaded polygons are specified by the SMOOTH shading model while the FLAT shading model species implementation of single-colored polygons. The steps involved are; Shading and selecting model are enabled The normals are specified Material property is specified and The lights are specified. Normals The normal vectors I always part of the state set by glNormal*(). The cosine calculations must be correct for the normal to have unit length. This is so because length affects transformation, scaling never preserves length and the initial function only allows auto normalization at a performance penalty. For example; In the normal for a triangle, the right-hand rule establishes the outward face. Enabling Shading The function glEnable (GL_LIGHTING) enables shading calculations. After enabling lighting, the glColor() is ignored. The light sources must be enabled individually and then the choice for light model parameters made. Point Light Source Definition After choosing the light parameters, each light source can be set to diffuse, specular or ambient modes with the use of RGBA. The function GL float is used. Distance and Direction The source colors must be specified. This is done in the RGBA. After that, position is specified in homogeneous coordinates. For example; If w-1.0, specifies a finite location and If w=0.0 specifies a parallel source of color through the given vector direction. Constant terms like a=1.0, and linear and quadratic terms, b=c=0.0 are coefficients in distance terms and are by default. These coefficients change by the function a=0.80 accompanied by the attenuation function. Spotlights The function glLightv performs the following settings; the direction (GL_SPOT_DIRECTION), Cutoff (GL_SPOT_CUTOFF) and Attenuation (GL_SPOT_EXPONENT). Global Ambient Light This mode depends on the color of the sources of light. For example, a green light in a white room will cause a green ambient term that disappears when light is off. The software is in a position of allowing a global ambient term used for testing. Moving Light Sources The positions or directions of light sources which are geometric objects are affected by the model-view matrix. The position of the setting function enables; the movement of the light source with the objects, fixing the object while moving the light source, fixing the light source as the object moves and moving the light source as the object moves independently (Angel, 2005 pp.4-11). Bibliography Addison-Wesley Publishing Company (1997). The Official Guide to Learning OpenGL, Version 1.1. Silicon Graphics; U.S.A.. Ahmed, S. (2009). OpenGL-Lighting, Material, Shading and Texture Mapping; Computer Graphics. IIT Bombay; India. Angel, E. (2005). Interactive Computer Graphics 4E: Shading in OpenGL. Addison-Wesley; U.S.A. Read More
Cite this document
  • APA
  • MLA
  • CHICAGO
(“Graphics and Games Essay Example | Topics and Well Written Essays - 1000 words”, n.d.)
Graphics and Games Essay Example | Topics and Well Written Essays - 1000 words. Retrieved from https://studentshare.org/information-technology/1473287-graphics-and-games
(Graphics and Games Essay Example | Topics and Well Written Essays - 1000 Words)
Graphics and Games Essay Example | Topics and Well Written Essays - 1000 Words. https://studentshare.org/information-technology/1473287-graphics-and-games.
“Graphics and Games Essay Example | Topics and Well Written Essays - 1000 Words”, n.d. https://studentshare.org/information-technology/1473287-graphics-and-games.
  • Cited: 0 times

CHECK THESE SAMPLES OF OpenGL Lighting and Shading

Lightning protection of photo-voltaic

The place where lighting incidents are repeated, unprotected PV devices can possibly undergo continued and considerable damage to vital parts.... Adequately engineered, predetermined and added surge protection devices reduce the prospective effect of lighting situations if employed in combination with fully optimized lightning protection devices....
20 Pages (5000 words) Thesis

Comparing between Chinese Monster and American Monster

According to the old man, burning of bamboo, beating gongs and drums, lighting off fireworks would be an effective approach to conquering Nian (Wong 27).... The paper "Comparing between Chinese Monster and American Monster" highlights that the Chinese attach more importance or significance to personal relationships compared to Americans....
9 Pages (2250 words) Coursework

Lightning Protection of Electrical Substations

lighting strikes on substations or on the transmission lines connected to them are a major cause for the supply disruption.... The topics examined include the provision of air terminals, correctly sized down conductors and an effective earth system to conduct direct lighting strike currents safely to earth....
37 Pages (9250 words) Thesis

Fire Incident at the Scarborough Civic Hall

The paper 'Fire Incident at the Scarborough Civic Hall' is an impressive example of the case study on environmental studies.... I am Hamad AL Mazmi employed by UAE Fire and Rescue Service (UAEFRS) as a watch manager, my current role is that of Incident Intelligence Officer, I have been employed by UAE Fire and Rescue Service since 2002....
14 Pages (3500 words) Case Study

Risk Management for the Anywhere Community Centre Fire

This case study "Risk Management for the Anywhere Community Centre Fire" presents fire risk management as a function of probabilistic risk analysis that is taken into account during fire design prevention engineering.... Fire risk management provides an appropriate recommended level of health.... ...
12 Pages (3000 words) Case Study

Fire Investigation in Lancashire Fire and Rescue Services

This report "Fire Investigation in Lancashire Fire and Rescue Services" discusses fire ignition due to smoking materials that could also be considered as one of the possible causes of the fire since the location of the risk factors of smoking materials are very adjacent to the location of the fire....
12 Pages (3000 words) Report

Fire Protection - Building Details and Fire Safety Risk Assessment

This report "Fire Protection - Building Details and Fire Safety Risk Assessment" discusses the Regulatory Reform, under which the building owner should implement general fire precautions associated with detection, fire fighting, escape routes and exits, and mitigation of the effects of fire.... ... ...
23 Pages (5750 words) Report

The Vulnerabilities of Intelligent Building Systems

The paper "The Vulnerabilities of Intelligent Building Systems" is a great example of a Technology essay.... According to Myers (2010), the need for regional, national, and global security has continuously evolved into an issue of global concern in the contemporary world.... .... ... ... The paper "The Vulnerabilities of Intelligent Building Systems" is a great example of a Technology essay....
12 Pages (3000 words) Essay
sponsored ads
We use cookies to create the best experience for you. Keep on browsing if you are OK with that, or find out how to manage cookies.
Contact Us