Status – Week 277 - PowerPoint PPT Presentation

Status week 277
1 / 23

  • Uploaded on
  • Presentation posted in: General

Status – Week 277. Victor Moya. Lightning. Diffuse Lightning. Light Sources. Specular Lightning. Emission. Gouraud Shading. Phong Shading. Bump Mapping. OpenGL Lightning. Light Sources. Ambient Light. Directional Light Sources Infinite light source (parallel rays). No attenuation.

I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.

Download Presentation

Status – Week 277

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

Status week 277

Status – Week 277

Victor Moya



  • Diffuse Lightning.

  • Light Sources.

  • Specular Lightning.

  • Emission.

  • Gouraud Shading.

  • Phong Shading.

  • Bump Mapping.

  • OpenGL Lightning.

Light sources

Light Sources

  • Ambient Light.

  • Directional Light Sources

    • Infinite light source (parallel rays).

    • No attenuation.

  • Point Light Sources.

    • All directions.

    • Attenuation.

  • Spot Light Sources.

    • Cone of light.

    • Attenuation.

      Kc, Kl and Kq are constant, linear and quadratic attenuation values.

      U: Direction of the spot light.

      L: Unit direction vector from surface point to light spot.

Diffuse lighting

Diffuse Lighting

A: Ambient light

T: Texture sample.

D: Surface diffuse reflection color.

Ci: Intensity of the i light at the surface point.

N: Normal vector of the surface.

Li: Unit direction vector to the light source I.

Specular lighting

Specular Lighting

S: Surface specular color.

Ci: Intensity of the incident light.

m: specular exponent (larger, sharper hightlight).

G: Gloss map sample.

N: Normal vector at the surface.

L: Unit direction to light vector.

Hi: Halfway vector (V + L).

V: Unit direction to viewer vector.



Kemission = EM

E: Surface emission color.

M: Emission map sample.

Gouraud shading

Gouraud Shading

  • Lighting is calculated at each vertex and interpolated across the triangle.

    K = Kprimary * T1 * T2 * ... * Tk + Ksecondary

    Ti : Color samples for one of k texture maps.

    * : One of several available texture combination operations

Phong shading

Phong Shading

  • Interpolate vertex normals and evaluates the lighting formula at each pixel.

    K = Kemission + Kdiffuse + Kspecular

  • Problem: interpolation of normals produce non unit vectors. Use normalization cube maps.

Flat gouraud and phong shading

Flat, Gouraud and Phong Shading

Bump mapping

Bump Mapping

  • A hardware implementation of Phong Shading.

  • Uses a texture map to perturb the normal vector at each pixel (not interpolated).

  • Bump Map: 2D arrays of 3D vectors. Direction of the normal vector relative to the interpolated normal vector at the pixel.

  • Uses tangent space for storing the perturbations. Object to tanget space transformation (3x3 matrix multiplication).

Bump mapping1

Bump Mapping

Opengl lighting

OpenGL Lighting

  • Calculated at vertex, interpolated inside the triangle (Gouraud).

  • Bump mapping supported by propietary extensions.

  • Pixel Shaders for programmable per pixel lighting.

Opengl lighting1

OpenGL Lighting

Opengl lighting2

OpenGL Lighting

Opengl lighting3

OpenGL Lighting

Hardware pipeline

Hardware Pipeline

  • Command Processor.

  • Vertex Shader.

  • Rasterization.

  • Pixel Shader.

  • Fragment Operations and Tests.

Command processor

Command Processor

  • Recieves commands from the CPU (driver, OpenGL/Direct3D).

  • Fetches data from memory: vertex data (DMA).

  • Updates and stores OpenGL/Direct3D render state.

Vertex shader

Vertex Shader

  • Transforms and lits vertex streams.

  • Vertex shader program (from GPU memory?).

  • Vertex shader constans (from GPU memory?).

  • Inputs: vertex data 16x4D

  • Outputs: vertex data 14x4D



  • Includes:

    • Clipping

    • Divide by w

    • Affine transform

    • Primitive assembly

    • Culling

    • Setup

    • Fragment generation.

  • Recieves vertexs and produces fragments.

  • Uses OpenGL/Direct3D render state.

  • Input: vertex (15x4D).

  • Output: fragments (10x4D).

Pixel shader

Pixel Shader

  • Shades fragments: calculate texture address, read texture, color operations.

  • Pixel Shader program and constants (from GPU memory?).

  • Texture read: TMU (texture sample, filter unit, texture cache, GPU memory).

  • Optional:

    • Modify depth coordinate (1 Z output).

    • Render to texture (up to 4 colors outputs).

  • Input: fragment (12x4D).

  • Output: color (2x4D).

Fragment operations and tests

Fragment Operations and Tests

  • Includes (OpenGL):

    • Fog.

    • Color Sum.

    • Ownership Test.

    • Scissor Test.

    • Alpha Test.

    • Stencil Test.

    • Depth Test.

    • Blend.

    • Logic Operation.

  • Accesses framebuffer (GPU memory). Updates framebuffer.

  • Framebuffer: color, Z and stencil.

  • OpenGL/Direct3D render state defines operations.

  • Input: color.

  • Output: FB updated.



  • Antialiasing

    • Anisotropic Filtering (textures).

    • Line Antialiasing.

    • Edge Antialiasing

    • Full Screen Antialiasing (FSAA):

      • Supersampling.

      • MultiSampling.

  • TBDR: Tile Based Deferred Rendering (STMicro PowerVR).

  • HOS (High Order Surfaces): N-Patches, Bezier, Displacement Mapping, TruForm, Tesselation.

  • Login