Advanced Computer Graphics: Laboratory Project

<< PREV | INDEX | NEXT >>

Task 2A: Create a Sampler for the Environment Map

Preparation

Locate $TASK 2A in the CgFX file 'carscene-2.fx'.

Description

Texture variables are the .fx file representation of the texture interfaces. Texture parameters also have annotations that specify what type of texture and where the texture should come from. This information is read by the application, which then creates a texture using that information and sets the interface back into the effect for use. In this case, the sampler looks for type and name annotations in order to correctly load the texture.

The sampler variable is the CgFX representation of how to do lookups. The texture intrinsics require a sampler, because a sampler encompasses the concept of the texture and the method in which to do the lookup (that is, types of filtering, and so on). In .fx files, samplers can also have sampler_state blocks that specify the state to be loaded into the device whenever that sampler is used.

Hint

Create a samplerCUBE variable called samplerEnvironmentBilin with the semantic ENVIRONMENT_MAP.

Add a sampler_state block that sets the following states:

  1. MinFilter to Linear
  2. MagFilter to Linear

Build/run the application when you think you have completed this task.


<< PREV | INDEX | NEXT >>