Tuesday, May 8, 2007

Tanning To Eliminate Severe Acne Scars



1 .- Find out how to create and define a light source in OpenGL creation of light:
CREATION OF LIGHT SOURCES
The properties of a light source are the color, position and direction. The command used to specify all the properties of a light is glLight * (), has three arguments to identify the light that is being used, property and the desired value for esapropiedad.
After defining the characteristics of the lights, turn it on with the command glEnable (). Also need to call this command with the parameter GL_LIGHTING, so be prepared to develop OpenGL lighting calculations.

How many lights can be set?:
We have eight light sources in the scene (there may be more dependent on the implementation of OpenGL. OpenGL needs to perform calculations to determine how much light each vertex receives from each source light. The increase in the number of lights affects slower execution.

Configuring the light source

glLight void {if} [v] (GLenum light, GLenum pname, TYPE param) Creates
light specified by light, which can be GL_LIGHT0, GL_LIGHT1,
... GL_LIGHT7. The light characteristics are defined by pname. The argument
param indicates the values \u200b\u200bthat the feature set pname, if you use the version of
vector (v) pname is a pointer to a set of values, or the actual value if the version without vector is what we are using (i f).
default values \u200b\u200bfor the parameter pname of glLLight * ().
Types of lights

In OpenGL there are three basic types of lights: Turn signals
local

Lights Spotlights
All types of lights to define an environmental component, a diffuse and specular RGBA components. Define
light sources (properties of each of the lights). GLvoid
glLightfv (GLenum light, GLenum pname, const GLfloat * params);
Light: Light to which reference is being made (GL_LIGHT0, GL_LIGHT1, GL_LIGHT2, etc.).
* params is an array of RGBA values, each value defines the percentage of intensity of each color is light. Directional lights

A directional light is located at infinity
Define the vector
directional diffuse float [3] = {1.0,0.0,0.0};
float direction [4] = {1.0,1.0,1.0,0.0};
glLightfv (GL_LIGHT0, GL_POSITION, direction};
glLightfv (GL_LIGHT0, GL_DIFFUSE, diffuse);
local lights
local lights are defined in the same way that the directional only the fourth element of the vector equals one.
float diffuse [3] = {1.0,0.0,0.0};
float position [4] = {1.0,1.0,1.0,1.0};
glLightfv (GL_LIGHT0, GL_POSITION, position};
glLightfv (GL_LIGHT0, GL_DIFFUSE, diffuse);
Light Bulbs
The focus is defined as: a local light, an address or a opening of the bulb.
float diffuse [3] = {1.0,0.0,0.0};
float position [4] = {1.0,1.0,1.0,1.0};
float direction [3] = {1.0,1.0,1.0};
glLightfv (GL_LIGHT0, GL_POSITION, position};
glLightfv (GL_LIGHT0, GL_DIFFUSE, diffuse )
glLightfv (GL_LIGHT0, GL_SPOT_DIRECTION, address) / / Address of focus
glLightf (GL_LIGHT0, GL_SPOT_CUTOFF, 20), / / \u200b\u200bcutting angle between 0 and 180


Light color OpenGL allows you to associate any light three color-related parameters:
GL_AMBIENT, GL_DIFFUSE, GL_SPECULAR. GL_AMBIENT parameter refers to the RGBA intensity of ambient light that a light source adds to the scene. The default is no ambient light. The GL_DIFFUSE parameter is the one most related to the concept that we normally "light color" refers to the RGBA intensity of light diffused light source adds to the scene. The default is (1.0, 1.0, 1.0, 1.0) for GL_LIGHT0 that produces a bright white light. The default value is GL_LIGHT1 ... GL_LIGHT7 (0.0, 0.0, 0.0, 0.0). GL_SPECULAR parameter affects the specular color of an object. An object like a glass mirror has a light that is the color of the light is shining on it, usually white. If we want to create a realistic effect, and GL_DIFFUSE GL_SPECULAR parameter must be set the same value. Enabling

and desabilitación
light for the light to take effect you must activate the lighting model calculation using the lights using the call: glEnable (GL_LIGHTING) and to disable glDisable (GL_LIGHTING)
and activate each of the individual lights that are
want to use with glEnable (GL_LIGHTn) and disable glDisable (GL_LIGHTn)

Light by defaul and features by defaul
is a basic ambient light which specify how to perform the lighting of the scene as to whether the lights affect two parts of an object model for calculating the relationship between the observer and the objects in the case of specular component. Properties to set
basic lighting model:
glLightModelfv (GL_LIGHT_MODEL_AMBIENT, environment), / / \u200b\u200benvironment values \u200b\u200blacomponente base.
GlLightModelf (GL_LIGHT_MODEL_TWO_SIDE, TRUE) / / afectana lights both sides of a material.
GlLightModelfv (GL_LIGHT_MODEL_LOCAL_VIEWER, TRUE); / / Put the method of calculating local observers speculate, if not all calculations are done as if the observer was located on the Z axis


2 .- Investigate the difference between light illumination I (ligth / ligthing)

desabilitación Enabling and lighting (how?)
To enable / disable all lighting within a scene is used:
glEnable (GL_LIGHTING)
glDisable (GL_LIGHTING)

For there to enable or disable lighting
With OpenGL you need to explicitly enable or disable lighting. If no color is enabled
now is mapped to the vertex but normal calculations, light sources, lighting model and material properties do not occur.

3 .- Research the definition of material properties to a surface
Ø The OpenGL lighting model makes an approximation of the color of a material according to the light striking it and the light that is able to reflect
Ø For example a perfectly red ball is the one object whose material is capable of absorbing all wavelengths except red and is able to reflect only that color
or materials have two properties on colors, which indicate how it affects each of the properties of a ray of light on it
Ambient
Ø Ø Ø Diffuse
also has three properties on the emission capacity and light reflection Specular

Ø Ø Ø shininess

Ambient Emission
Ø Ø marries Ambient property of a beam light and indicates how the material will behave according to the component Ambient light beam incident
Ø refers to the color material default
Ø Ø Diffuse
marries Diffuse ownership of a ray of light and indicates how the material will behave according to the Diffuse component of the incident light beam Ø
refers to the light reflected from diffusely
Ø These two properties determine the color of the material and usually have approximate values \u200b\u200bbut equal
Ø Ø Specular
marries Specular property of a light beam and indicates how the material will behave according to the Specular component incident light beam
speculate or property is usually defined white or gray, so that the reflections of the material are broken down from the base color of the incident light to the color defined in this property
shininess
Ø Ø Determine the concentration of the points will reflect the light
or may be a single point or all the object's surface

Ø Emission
l This property defines the ability to simulate a
light output L is not a light source
l define the colors of light emitted is used to simulate
l stars, lamps, or similar objects

surface characteristics (diffuse, specular, brightness, emissivity, etc.)

Ambient Light Ambient light is one that does not come from a direction which affects all parts of the object equally. Iambiente
Ia ka ka =
environmental reflection coefficient [0.1] dependent on each object. Environmental
the intensity at any point in space. Scattered light


• The source has a particular location and direction
• Once the object touches the surface, is reflected in all directions
The diffuse light is coming from a particular direction and is reflected in all directions.
affects those parts of the object on which light falls.
The diffuse light is reflected from the surface of an object so motionless.
IL:
source intensity q: Angle of Incidence [0 ° .. 90 °]
Kd: scattering coefficient for each object [0 .. 1]
N: Normal to the surface (Unit)
L: Vector Lighting (unit)

• Specular light is also directional, but the reflection occurs in a particular direction
• Produces bright spot on the surface that lights up ->
specular Specular light comes from a particular direction and is reflected in one direction.
produces intense glare.
Specular reflections are usually the same color as the source of light.
The intensity of the specular reflected light depends on:
The wavelength of incident light
The angle of incident light
Material characteristics
a perfect mirror in the direction from which we observe the reflection is the perfect reflection direction R.
Specular reflection depends on the observer's position.
Depending on the size (degree of polishing) the brightness is more or less concentrated around the point where R and V coincide. GLOSS

are based on the materials specular component produces a bleaching

material depends on the point of view produces specular

For shiny material, the light must contain a non-zero specular component:
Spec [] = {1.0f, 1.0f, 1.0f, 1.0f};
glLigth (GL_LIGHT0, GL_SPECULAR, Spec);
material that has a bearing on should also have a non-zero specular component:
GLfloat specular [] = {1.0f, 1.0f, 1.0f, 1.0f}; glEnable (GL_COLOR_MATERIAL) glColorMaterial (GL_FRONT, GL_AMBIENT_AND_DIFFUSE) glMaterialfv (GL_FRONT, GL_SPECULAR, specular);

The brightness of the material property determines the size of the surface to reflect the brightness
glMaterialf (GL_FRONT, GL_SPECULAR, mat_option)
glMateriali (GL_FRONT, GL_SHININESS, 128);

The value of this component varies between:
0 The surface is a 128 point
entire surface of the object reflects
SHADOWS
Absence of light produced usually by the superposition of an opaque body between a light source and another body
In OpenGL projections are only made on volumetric objects
Types of Shadows: Shadows

Volumetric shadows shadows

is the simplest technique and involves calculate a projection matrix onto the plane on which you want to draw the shadow
Once calculated this matrix, when multiplied by the matrix model, and draw the rest of the figures, they will be projected onto that plane

volumetric shadows
The prior art is simple, but only serves to draw those leftovers
If projected on planes it has a composition of figures in which a cast shadows on each other, with the prior art can not be represented
To avoid this using a special matrix that will calculate the influence of the position of an object on the other

FOG
Effect special blend used for a scene giving the impression that it is actually covered by a mass of fog
Overall color is to blur the scene, obscuring the most distant objects even to disappear, while closer objects appear more
light fog effect can be applied in two main ways:
Based on Based on tables
vertices
How
is defined on which side (s) of a polygon apply the materials? It has the function

glMaterial void {if} {v} (GLenum face, GLenum pname, TYPE * param);
Where:
glMaterial parameters {fv}
Face: Indicates the face on which to apply the à GL_FRONT
material is used on the front faces of the object
à GL_BACK Apply on the inner surfaces of the object
à GL_FRONT_AND_BACK applies on all faces of the Param
: Indicates the property to be set from the already explained 4 .- Invetige about texture mapping in OpenGL

bytmap Load-definition

load is opening the bitmap file directly and assigning it to a pointer and then paint it: bool
CTextura: CargarBMP (char * szNombreFichero)

{FILE * hFichero;
AUX_RGBImageRec * Image;
bool bResult = false;


if ( szNombreFichero) / / Check that the filename is correct
{
hFichero = fopen (szNombreFichero, "r"); / / Check if file exists (if we can open it)

if (hFichero) / / Is there a file ?

{fclose (hFichero) / / Close the handle
Create (szNombreFichero)

Image = auxDIBImageLoad (szNombreFichero) / / Load the BMP
m_nAncho = image-> sizeX;
m_nAlto = image-> SizeY;

glTexImage2D (GL_TEXTURE_2D, 0, 3 , m_nAncho, m_nAlto, 0, GL_RGB, GL_UNSIGNED_BYTE, Image-> data);

bResult = true;

}}
delete Image-> data;
delete Image;
return bResult;}


texture transformation and Ways of applying a texture (repeat, wrap, etc)

function is indicated by:
texture size is usually not the same as the projected polygon is pasted on, there will be cases where the size of the texture will be greater than the projected polygon and others that will be lower.

need to specify how to calculate the final color of the pixels on the projected polygon, from the texture image. In addition, we may be interested in the texture is repeated at certain intervals of time. All of this behavior is set through the function: void

glTexParameter {if} {v} (GLenum tipoTex, GLenum param, TYPE value);

where tipoTex can be GL_TEXTURE_1D or GL_TEXTURE_2D and param and value can take values \u200b\u200bfrom the table below: Parameter Value


GL_TEXTURE_WRAP_S GL_CLAMP, GL_REPEAT
GL_TEXTURE_WRAP_T GL_CLAMP, GL_REPEAT
GL_TEXTURE_MAG_FILTER GL_NEAREST, GL_LINEAR
GL_TEXTURE_MIN_FILTER GL_NEAREST, GL_LINEAR,
GL_NEAREST_MIPMAP_NEAREST,
GL_NEAREST_MIPMAP_LINEAR,
GL_LINEAR_MIPMAP_NEAREST,
GL_LINEAR_MIPMAP_LINEAR
GL_TEXTURE_BORDER_COLOR four values \u200b\u200bin the interval [0 ... 1]

An example of its use is as follows:
glTexParameterfv (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT)
glTexParameterfv (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT)

Texture Mapping

surface texture is initialized before indicating the type of surface including:
glTexParameterfv (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT)
glTexParameterfv (GL_TEXTURE_2D , GL_TEXTURE_WRAP_T, GL_REPEAT)
The first allows the textures are repeated horizontally, and the second vertical
.
With this change, we could map the texture coordinates
greater than 1, so the textures are repeated, thus:
glBindTexture (GL_TEXTURE_2D, texture_floor)
glBegin (GL_QUADS)
glTexCoord2d (0.0,0.0)
glVertex3f (-6.0,0.0, -6.0);
glTexCoord2d (0.0,6.0);
glVertex3f (-6.0,0.0,6.0)
glTexCoord2d (6.0,6.0);
glVertex3f (6.0,0.0,6.0);
glTexCoord2d (6.0,0.0);
glVertex3f (6.0,0.0, -6.0);
glEnd ();

0 comments:

Post a Comment