phong_lighting - JayDee-github/LearnOpenGL GitHub Wiki

Phong lighting

This implementation applies Phong-lighting techniques.

The Phong-lighting model combines three lighting schemes to simulate realistic lighting effects:

  1. Ambient-lighting: simulates overall scattered light.

    Ambient

  2. Diffuse-lighting: applies the directional qualities of light. The more direct a surface is to a light source, the brighter that surface will be.

    Diffuse

  3. Specular-lighting: simulates bright spots and material shininess.

    Specular

The code follows examples outlined outlined in:

Changes over example code

  • The light source is given movement.
  • Extra cubes are added to show examples of each Phong component. The lighting parameters were chosen for each cube to accentuate the lighting scheme it exemplifies.
    • Cyan: Ambient
    • Blue: Diffuse
    • Green: Specular

Running the implementation

  • Navigate the Solution Explorer to path:

    Solution -> 02.lighting -> 01-03.phong_lighting

  • Left-click the project name and select Set as Startup Project from the pop-up window.

  • Press F5 to run the project.

Interfacing with the implementation

Exiting

Press the ESC key to exit the implementation.

Movement

The movement key-bindings follow an FPS-style scheme:

  • W move forward
  • S move back
  • A move left
  • D move right
  • Spacebar move up
  • Left-Shift move down
  • Mouse-movement look around the world