opengl source code for simple light with report
#1

please give me the report of simple light movement
Reply
#2

You are seeing the standard OpenGL Light model on this screenshot diagram consisting of 3 abstract components: Ambient Light, Diffuse Light (color of the light source ) and specular highlight (the shiny, glossy reflection spot).

When working with light in OpenGL we are dealing with abstract representation of light rather than a perfect, correct model of light in the real world. That level of realism is desirable, but given computational limits of home computers and consoles light must be approximated. In the future, we will have real time ray-tracing graphics, but we're not there yet. Until then, we need to approximate light using abstract models.

"Let there be light," and there was light. While we as mere mortals cannot speak light into existence, we can observe its certain properties and use them to create computer graphics.

Light is important and so you will be able to understand the basics of it after reading this tutorial, whether you're learning about it from GLSL vantage point, or if you are looking for any beginner information about how light works in OpenGL.

In the beginning I will explain what light is and what basic types of light there are in OpenGL (Ambient, Diffuse and Specular.) Toward the end, a more technical, OpenGL-specific text is presented. The complete source code for this tutorial is included as a demonstration of a simple, flat, non-textured 3D model affected by a light source. For this purpose I will use the previously explained [*.m] (a very simple 3D model I explain in another tutorial on this site) format file model-loading code, which I suggest you look at. It's a great way to load and preview entire models instead of hard-coding new polygons all the time.

There isn't a great necessity for this model reader in particular. You can try to define your own polygon with straight OpenGL code or use your own 3D model loader. I just figured people who are learning about light may fall into the same category as ones who may be also interested in learning how to make a model loader. Sooner or later, you will need to be able to load 3D models into your OpenGL application.

So, I assume no previous knowledge whatsoever about light and what it is. So let’s begin our journey from the dark into the light by going through a very brief lecture about the nature of light..

Below, is a brief example of OpenGL light command glLightfv that enables specular highlight (we will learn about specular light in just a moment) on a light source with ID GL_LIGHT0. By default in OpenGL there are up to 8 light sources identified by ID handles GL_LIGHT0 through GL_LIGHT7.

GLfloat specular[] = {1.0, 1.0, 1.0, 1.0};
glLightfv(GL_LIGHT0, GL_SPECULAR, specular);

OpenGL does a lot of work for us. Just doing this, and later enabling GL lighting with another function we are not ready to discuss yet, will make it possible for us to make shiny spots on your 3D objects.

But first, let's think about what light is. And return to code a bit later to put this new knowledge into practice. Let's expand our understanding of how light works in nature and later apply it to 3D programming with OpenGL using API calls available to us.

1. The nature of light


INTRODUCTION

If you want to know and understand what light represents in nature, you will read this section. If you want to program light in OpenGL you will read the following one. But if you want to be an educated human being and programmer, I’m terribly sorry but I think you’re going to have to read both.

To become good at something such as programming it’s not enough to just know certain functions and know when to call them. Thorough knowledge is required. So be patient my friend, as we move forward.

Just as in Beginner's OpenGL Tutorial - Introduction to 3D, most common terms behind 3D rendering theory were explained, in the this tutorial we will start with introduction to light.


WHAT LIGHT IS

Light is the most important idea behind visual representation of anything that a human being can visually perceive. The idea of perception of light lies in the fact that what you can see isn’t based on the objects that you are viewing but on the rays of light cast from a light source and reflected from those objects. It’s important to note that your eyes don’t directly see objects as there is no physical correlation between your eyes and those objects.

All of this is theoretical, of course. We use the term light rays to merely abstract a more complex mechanism.

So the light rays commonly originate from an energy source such as the sun or a lamp in your room. It’s important to note that theoretically a ray of light travels in a straight line and by the time you visually perceive an object, it is the rays of light reflected or scattered off that object that your eyes absorb. From now on you will have to think of light in terms of theoretical rays as described in this tutorial and not as just “something invisible that makes objects brighter”. This becomes more important when you start programming your own 3D light graphics engine, as opposed to using the predefined set of OpenGL light-modeling functions.

So from this, the two rules to understand are:

1. Your eyes are mechanisms created to directly perceive or absorb the photons(more about photons in a second) of light and not the objects. And you are, as a programmer, destined to simulate this functionality on the computer screen.

2. A ray of light travels in a straight line.

The second point however, is not entirely correct, but can be correct at the same time -- let’s discover the theory of light a bit further to understand what is meant by this statement. A side note on what is known about the light by scientists will help…


LIGHT AS BOTH: A STREAM OF PARTICLES AND A WAVE OF ENERGY

There are two ways that light could be thought of as. There is a theory of light particles described by PHOTONS. And there is a theory of light being a WAVE of energy. In ancient Greece the light was thought of as a stream of particles which travel in a straight line and bounce off a wall in a way that any other physical objects do. The fact that light couldn’t be seen was based on the idea that the light particles are too small for the eye to see, traveled too fast for the eye to notice them or that the eye was just seeing through them.

In the late 1600s it was proposed that the light was actually a wave of energy and didn’t travel exactly in a straight line being a stream of particles. By 1807 the theory of light waves was confirmed with an experiment that demonstrated that the light, passed through a narrow slit radiates additional light outward on the other side of the slit. So it was proven that the light has to travel in a form of a wave in order to spread itself that way, and not in a straight line. It is important to note that a beam of light radiates outward at all times.

The theory of light was developed further by Albert Einstein in 1905. He described the “photoelectric effect”. This theory described activity of the ultraviolet light hitting a surface, emitting electrons off that surface. This behavior was supported by an explanation that light was made up of a stream of energy packets called PHOTONS.

To conclude, it is observed that the light can behave as both: a wave and also as packets of energy particles: PHOTONS. There is no solid explanation of the more complex underlying structure of how light works, as of yet.


THE COLOR OF LIGHT

In this section I describe what light is in more detail. Specifically, how color is being perceived by the viewer. As discovered in the previous section light is a wave of energy. The most apparent quality of light lies in representing color. Color is tightly connected to the concept of light. Let's see how.

The light that can be seen by the human eye is in general a mixture of all kinds of different lights scattered and reflected against the surroundings with different material properties. All physical matter is made up of atoms. The mechanics of reflection of photons off physical matter depends on various things such as the kind of atoms, the amount of each kind and the arrangement of atoms in the object that the photons are being reflected off. Some photons are reflected and some are absorbed. When photons are absorbed they are usually converted to heat. The defining factors of the visual quality of a material lie within this matter absorption-and-reflection concept. The color that the material reflects is observed as that material's color. Also, the more light the material reflects the more shiny it will appear to the viewer.

Each different color is simply energy which can be represented by a wavelength. What's important to note is that color is only a wavelength visible to the eye. A wavelength is measured by the distance between the peaks of the energy wave. Consider this image.
Reply

Important Note..!

If you are not satisfied with above reply ,..Please

ASK HERE

So that we will collect data for you and will made reply to the request....OR try below "QUICK REPLY" box to add a reply to this page
Popular Searches: opengl source code for a simple moving car, project report of 6th sem simple moving light opengl source code, snowman opengl report, simple java source code, opengl projects with source code and report, full report of rain for opengl code, simple move light opengl code,

[-]
Quick Reply
Message
Type your reply to this message here.

Image Verification
Please enter the text contained within the image into the text box below it. This process is used to prevent automated spam bots.
Image Verification
(case insensitive)

Possibly Related Threads...
Thread Author Replies Views Last Post
  simple java rmi chat application source code 2 19,213 20-07-2018, 12:08 PM
Last Post: Guest
  development of road light gateway with sensor network ppt 2 1,820 15-04-2018, 05:30 PM
Last Post: Guest
  authentication schemes for session passwords using color and images project source code 2 2,238 03-02-2018, 09:35 AM
Last Post: Nischithnash
  free download source code for online movie ticket booking in java 2 18,724 15-08-2017, 03:21 PM
Last Post: Morshed
  opengl synopsis for train moving 3 1,286 05-06-2017, 09:45 AM
Last Post: jaseela123d
  source code for rsa encryption and decryption in java 2 8,021 29-05-2017, 04:21 PM
Last Post: Meghna Jadhav
  download liver tumor ct scan image in matlab with source code 4 8,070 21-05-2017, 09:54 PM
Last Post: abdulrahmanmashaal
  online cab booking source code in asp net 3 7,946 11-05-2017, 10:39 AM
Last Post: jaseela123d
Thumbs Up online catering management system on php with report and source code and ppt 4 8,806 29-04-2017, 10:59 AM
Last Post: jaseela123d
  source code for task scheduling using genetic algorithm using java 2 8,532 11-04-2017, 08:31 PM
Last Post: Guest

Forum Jump: