Color and texture
This presentation is the property of its rightful owner.
Sponsored Links
1 / 40

Color and Texture PowerPoint PPT Presentation


  • 77 Views
  • Uploaded on
  • Presentation posted in: General

Color and Texture. Electromagnetic Spectrum. Candelas / sq meter. Computer Screen 1.8 - 150 ~2 orders of magnitude. Physiology: Receptors. Rods active at low light levels (night vision) only one wavelength sensitivity function 100 million rod receptors Cones

Download Presentation

Color and Texture

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript


Color and texture

Color and Texture


Electromagnetic spectrum

Electromagnetic Spectrum


Candelas sq meter

Candelas / sq meter

Computer

Screen

1.8 - 150

~2 orders of magnitude


Physiology receptors

Physiology: Receptors

  • Rods

    • active at low light levels (night vision)

    • only one wavelength sensitivity function

    • 100 million rod receptors

  • Cones

    • active at normal light levels

    • three types: sensitivity functions peaks at different wavelengths (“red”, “green”, “blue”)

    • 6 million cone receptors

    • Focused in the center of vision (fovea)


The basis of color vision and measurement cone sensitivity functions

The basis of color visionand measurementCone Sensitivity Functions


Sharp aquos pixels

Sharp Aquos pixels


Gamma g

Gamma g

  • There is a non linear relationship between the signal given to a monitor and the Luminance that results.

L = Vg


Acquos curves

Acquos Curves


Important points

Important points

3 Cone types -> Trichromacy.

Need only three colors in monitor

Saturation is the vividness of a color. We cannot get full saturation

Luminance range is limited on a monitor

In the real world real world light is additive and linear.

Monitors are non-linear – must be corrected for accurate simulation


Basic cg lighting for each vertex

Basic CG lighting (for each vertex)

Diffuse = N.L

Specular = R.Vk

Ambient = Const

Specular has color of illumination

Ambient and diffuse are influenced by the pigment in the surface


Lighting with cast shadows

Lighting with cast shadows


Specular has the color of the illumination

Specular has the color of the illumination


Lambertian reflection

Lambertian reflection

Amount of light

Falling per unit area is

smaller as a function

Of the angle with the surface

cos(q)

q


Rendering approaches

Rendering approaches

  • Light Field

  • Ray Tracing

  • Radiosity

  • Direct polygon (simplification)

  • + Combinations of above


Illumination in opengl gllight gllightmodel

Illumination in openGLglLight, glLightModel

float light_position[] = {-10.0,20.0,20.0,1.0};

glLightfv(GL_LIGHT0,GL_POSITION, light_position);

float ambient[] = { 0.4f, 0.4f, 0.4f, 1.0f };

glLightfv(GL_LIGHT0, GL_AMBIENT, ambient);

float diffuse[] = {0.8f, 0.8f, 0.8f , 1.0f};

glLightfv(GL_LIGHT0, GL_DIFFUSE, diffuse);


For a light at infinity

For a light at infinity

  • Ir = lar*mar + ldr*mdr*(L·N) + lsr*msr*max(0,V·R)a

  • To get specular use V·Ra

  • with similar equations for the green and blue components.


Color and texture

  • gLlighting disables glColor, unless

  • glEnable(GL_COLOR_MATERIAL); is set

glMaterialfv(GL_FRONT, GL_SPECULAR, specReflection);

glMateriali(GL_FRONT, GL_SHININESS, 20); // note exponent

glColorMaterial(GL_FRONT,GL_AMBIENT_AND_DIFFUSE);


28 parameters

28 parameters

glMaterialfv(GL_FRONT, GL_AMBIENT, M_ambient);

glMaterialfv(GL_FRONT, GL_DIFFUSE, M_diffuse);

glMaterialfv(GL_FRONT, GL_SPECULAR, M_spec);

glLightfv(GL_LIGHT0, GL_AMBIENT, L_ambient);

glLightfv(GL_LIGHT0, GL_DIFFUSE, L_diffuse);

glLightfv(GL_LIGHT0, GL_SPECULAR, L_spec);

glMateriali(GL_FRONT, GL_SHININESS, k);

+Lighting direction


More lighting

More Lighting

  • Attentuation

    • float light_position[] = {-10.0,20.0,20.0,0.0};

    • glLightfv(GL_LIGHT0,GL_POSITION, light_position);

    • If last number is zero, light is at infinity.

    • If non-zero Light is positioned.

    • flLightf*GL_LIGHT0,GL_CONSTANT_ATTENUATION, const);

    • flLightf*GL_LIGHT0,GL_LINEAR_ATTENUATION, linear.);

    • flLightf*GL_LIGHT0,GL_QUADRATIC_ATTENUATION, quad);

    • attenuation = 1/(const+(linear*dist)+(quad*(dist*dist)))

  • Spotlights

    • glLight(GL_LIGHT0,GL_SPOT_CUTOFF, 45.0); // a 45 deg cone

    • glLight(GL_LIGHT0,GL_SPOT_EXPONENT, 2.0); // light concentration

  • Can have multiple lights


Lets simplify a two component model of lighting

Lets Simplify, A two component model of lighting

  • Lighting from a source at infinity.

  • + Ambient light (the rest of our surroundings)

  • (Note that these can be turned into one)

  • The surface reflects in two ways

  • Diffusely, and Specularly


Opengl lighting

OpenGL Lighting

  • Separate ambient diffuse and specular components of both the light and the surface color. (12)

  • + Light direction (3)

  • + shininess (1)

  • Total 60 parameters.

  • Easy to end up with summed components >1.0 for r,g,b.


Phong shading

Phong Shading

  • Interpolate surface normals

    Then apply lighting pixel by pixel


Gouraud shading

Gouraud Shading

Calculate lighting at vertices, then interpolate


Textures and texture mapping

Textures and texture mapping

Used for 1) Images (a picture in a 3D scene)

2) For surface properties (wood, stone)

3) Lighting effects.

Techniques include procedural textures and texture mapping

OpenGL supports texture mapping.


Perlin noise procedural textures

Perlin Noise (procedural textures)


Cube earth

Cube earth


Properties of textures in opengl

Properties of textures in OpenGL

  • 1D, 2D, 3D

  • Must have dimensions defined by a power of two. E.g. 512/256 for a 2D texture.

  • Have a coordinate system (s,t) from 0-1.


Color and texture

glGenTextures(4,texts); // texts is an unsigned int

glEnable(GL_TEXTURE_2D);

glBindTexture(GL_TEXTURE_2D, texts[1]); // make this the current texture

glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); // wrap in S | GL_CLAMP

glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); // wrap in T

glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);

glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);

glTexEnvi(GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE,GL_MODULATE);

glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 513,512,0, GL_RGB, GL_UNSIGNED_BYTE, stripes);

glDisable(GL_TEXTURE_2D);


Mipmaps

MipMaps

  • A hierarchy of textures

  • Helps with aliasing


Aliasing and anti aliasing

Aliasing and anti-aliasing


Short wavelength sensitive cones

Short wavelength sensitive cones

Blue text on a dark background

is to be avoided. We have very few

short-wavelength sensitive cones in

the retina and they are not very sensitive

Blue text on a dark background

is to be avoided. We have very few

short-wavelength sensitive cones in

the retina and they are not very sensitive.

Chromatic aberration in the eye is also a

problem

Blue text on dark background

is to be avoided. We have very few

short-wavelength sensitive cones in

the retina and they are not very sensitive

Blue text on a dark background

is to be avoided. We have very few

short-wavelength sensitive cones in

the retina and they are not very sensitive


Opponent process theory

Opponent Process Theory

  • Cone signals transformed into new channels


Color channel theory

Color Channel Theory

3:1 recommended

10:1 idea for small text

  • Luminance contrast needed to see detail


Comparing the channels

Comparing the Channels

Some natural philosophers

Suppose that these colors arise from the accidental vapours diffused in the air, which communicates their own hues to the shadow

Some natural philosophers

Suppose that these colors arise from the accidental vapours diffused in the air, which communicates their own hues to the shadow

  • Spatial Sensitivity

    • Red/Green and Yellow/Blue each about 1/3 detail of Black/White

  • Stereoscopic Depth

    • Pretty much can’t do it with hue alone

  • Temporal Sensitivity

    • Moving hue-change patterns seem to move slowly

  • Form

    • Shape-from shading works well

    • Shape-from-hue doesn’t

  • Information Labeling: Hue works well!

Some natural philosophers

Suppose that these colors arise from the accidental vapours diffused in the air, which communicates their own hues to the shadow


  • Login