cubemaps_and_reflections - JayDee-github/LearnOpenGL GitHub Wiki

Cubemaps and reflections

This implementation applies cube mapping and reflection techniques.

Models are loaded of a human-form encircled by a ring of rocks. A background environment is created by mapping 2D images to the interior of a large cube surrounding the scene. Reflections on the human model are simulated with reflection textures and vector calculations.

Models Reflections

The code follows examples outlined in:

Changes over example code

  • The ability to toggle between two cubemaps.
  • Integration with model-loading and lighting code to create an immersive scene.
  • Reflection-maps are extracted from the model files and used to create reflective effects on surfaces.

Running the implementation

  • Navigate the Solution Explorer to path:

    Solution -> 04.advanced_opengl -> 06.cubemaps_and_reflections

  • 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.

Rendering manipulations

The numeric keys 1-7 are used to switch rendering modes:

  • 1 Directional lighting: A white light from the ceiling illuminates the models.

    Directional lighting model Directional lighting rocks

  • 2 Point lighting: two point lights illuminate the models. An intense red light illuminates from the front while an equally intense blue light illuminates from the lower back.

    Point lighting front Point lighting back

  • 3 Wire mesh mode

  • 4 Vertex point mode

  • 5 Normal fill mode

  • 6 Space cubemap: a cubemap is loaded depicting a space environment.

    Space front Space back

  • 7 Lake cubemap: a cubemap is loaded depicting a lake environment.

    Lake front