Advanced Computer Graphics: Laboratory Project

<< PREV | INDEX | NEXT >>

Task 2: Environment Mapping

In this part you will be implementing environment mapping to simulate ray-traced reflections.

The environment mapping goal is divided into five tasks:

  1. Create a sampler for the environment map.
  2. Do a cubemap texture lookup.
  3. Calculate the reflection vector.
  4. Adjust reflectivity based on glossiness.
  5. Add a fresnel term.

Preparation

Edit the file 'fxstudio.ini' so that the application loads the effect file 'carscene-2.fx' (note that editing 'fxstudio.ini' requires restart of the application), i.e.:

[Scene]
effectfile = "carstudio-2.fx"

Open ‘carscene-2.fx’ in a text editor of your choice, or double click the file in the solution view in Visual Studio under fxstudio/fx. The .fx file is physically located at:

(Working directory)/fxstudio/fx/

Running the application will result in an error message. Do not worry, we will fix this in Task 2A.

Description

The fragment shader ‘psEnvironment’ uses the full lighting equation developed in part 1. The shaders have been modified to support diffuse texturing. Since you'll be adding support for environment mapping in this lesson, the placeholder code evaluates to black. In task A you will have to create a new sampler for the environment map as the code will not compile in its current state.


<< PREV | INDEX | NEXT >>