Defines | |
#define | CUBEMAP_SIZE 128 |
size of the cube map taken from the reference point of the object | |
#define | LR_CUBEMAP_SIZE 4 |
size of the cube map for diffuse/glossy reflections | |
#define | RATE (CUBEMAP_SIZE/LR_CUBEMAP_SIZE) |
cube map downsampling rate for diffuse/glossy reflections | |
#define | PI 3.14159f |
#define | TechniqueUsingCommonVS(name) |
a helpful macro to define techniques with a common vertex program | |
#define | Technique(name) |
a helpful macro to define techniques | |
Functions | |
ReduceTextureVS_output | ReduceTextureVS (ReduceTextureVS_input IN) |
See the pixel program. | |
float4 | ReduceTexturePS (ReduceTextureVS_output IN) |
Downsamples a face of a cube map. | |
float4 | GetContibution (float3 q, float3 L) |
Returns the precalculated contribution of a texel with regard to the specified query direction. | |
ConvolutionVS_output | ConvolutionVS (ConvolutionVS_input IN) |
See the pixel program. | |
float4 | ConvolutionPS (ConvolutionVS_output IN) |
Convolves the values of a cube map. | |
float3 | Hit (float3 x, float3 R, sampler mp) |
This function approximately traces a ray from point x towards direction R. Depth information is obtained from the alpha channel of mp. | |
float4 | metal_reflectivity (float3 L, float3 N, float3 V) |
Simple Fresnel term approximation for metals. | |
EnvMapVS_output | EnvMapVS (EnvMapVS_input IN) |
float4 | EnvMapImpostorPS (EnvMapVS_output IN) |
Environment mapping with distance impostors. | |
float4 | EnvMapImpostorMetalPS (EnvMapVS_output IN) |
float4 | EnvMapClassicPS (EnvMapVS_output IN) |
Classic environment mapping technique. | |
float4 | EnvMapClassicMetalPS (EnvMapVS_output IN) |
Classic environment mapping technique with a simple Fresnel term approximation (metal_reflectivity()). | |
float4 | EnvMapDiffusePS (EnvMapVS_output IN) |
Determines diffuse or specular illumination with a single lookup into PreconvolvedEnvironmentMap. | |
float4 | GetContibution (float3 L, float3 pos, float3 N, float3 V) |
Calculates the contribution of a single texel of SmallEnvironmentMap to the illumination of the shaded point. | |
float4 | EnvMapDiffuseLocalizedPS (EnvMapVS_output IN) |
Calculates diffuse or specular contributions of all texels in SmallEnvironmentMap to the current point. For each texel of SmallEnvironmentMap, function GetContibution(float3,float3,float3,float3) is called. | |
float4 | GetContibutionWithCosLookup (float3 L, float3 pos, float3 N, float3 V) |
Calculates the contribution of a single texel of SmallEnvironmentMap to the illumination of the shaded point. | |
float4 | EnvMapDiffuseLocalizedWithCosLookupPS (EnvMapVS_output IN) |
Calculates diffuse or specular contributions of all texels in SmallEnvironmentMap to the current point. For each texel of SmallEnvironmentMap, function GetContibutionWithCosLookup() is called. | |
IlluminatedSceneVS_output | IlluminatedSceneVS (IlluminatedSceneVS_input IN) |
float4 | IlluminatedScenePS (IlluminatedSceneVS_output IN) |
Displays the environment with a simple shading. | |
TechniqueUsingCommonVS (EnvMapClassic) | |
TechniqueUsingCommonVS (EnvMapImpostor) | |
TechniqueUsingCommonVS (EnvMapDiffuse) | |
Technique (IlluminatedScene) | |
Technique (ReduceTexture) | |
Technique (Convolution) | |
Variables | |
float4x4 | World |
World matrix for the current object. | |
float4x4 | WorldIT |
World matrix IT (inverse transposed) to transform surface normals of the current object. | |
float4x4 | WorldView |
World * View matrix. | |
float4x4 | WorldViewProjection |
World * View * Projection matrix. | |
float | texel_size |
upload this constant every time the viewport changes | |
float4 | eyePos |
current eye (camera) position | |
float4 | reference_pos |
Reference point for the last cube map generation. | |
int | nFace |
int | iShowCubeMap |
float4 | objColor |
float3 | nMetal |
real part of the refraction coefficient for metals | |
float3 | kMetal |
imaginary part of the refraction coefficient for metals | |
float | sFresnel |
Fresnel refraction param. | |
float | refractionIndex |
float | intensity |
float | shininess |
float | brightness |
texture | EnvironmentMap |
texture | SmallEnvironmentMap |
texture | PreconvolvedEnvironmentMap |
texture | Decoration |
sampler | EnvironmentMapSampler |
sampler | PreconvolvedEnvironmentMapSampler |
sampler | SmallEnvironmentMapSampler |
sampler | DecorationSampler |
|
size of the cube map taken from the reference point of the object
|
|
size of the cube map for diffuse/glossy reflections
|
|
|
|
cube map downsampling rate for diffuse/glossy reflections
|
|
Value: ; \ technique name \ { \ pass p0 \ { \ VertexShader = compile vs_3_0 name##VS(); \ PixelShader = compile ps_3_0 name##PS(); \ } \ }
|
|
Value: ; \ technique name \ { \ pass p0 \ { \ VertexShader = compile vs_3_0 EnvMapVS(); \ PixelShader = compile ps_3_0 name##PS(); \ } \ }
|
|
Convolves the values of a cube map. Calculates the diffuse/specular irradiance map of resolution LR_CUBEMAP_SIZE by summing up the contributions of all cube map texels with regard to the current query direction.
|
|
See the pixel program.
|
|
Classic environment mapping technique with a simple Fresnel term approximation (metal_reflectivity()).
|
|
Classic environment mapping technique. Simply determines the ideal reflection/refraction direction and performs a cube map lookup into that direction
|
|
Calculates diffuse or specular contributions of all texels in SmallEnvironmentMap to the current point. For each texel of SmallEnvironmentMap, function GetContibution(float3,float3,float3,float3) is called.
|
|
Calculates diffuse or specular contributions of all texels in SmallEnvironmentMap to the current point. For each texel of SmallEnvironmentMap, function GetContibutionWithCosLookup() is called.
|
|
Determines diffuse or specular illumination with a single lookup into PreconvolvedEnvironmentMap.
|
|
|
|
Environment mapping with distance impostors. Determines the ideal reflection/refraction direction and approximately traces a ray toward that direction using the Hit() function.
|
|
|
|
Calculates the contribution of a single texel of SmallEnvironmentMap to the illumination of the shaded point.
|
|
Returns the precalculated contribution of a texel with regard to the specified query direction.
|
|
Calculates the contribution of a single texel of SmallEnvironmentMap to the illumination of the shaded point. The only difference from GetContibution(float3,float3,float3,float3) is that now we use precalculated integral values to compute reflectivity (instead of using only one sample). |
|
This function approximately traces a ray from point x towards direction R. Depth information is obtained from the alpha channel of mp.
|
|
Displays the environment with a simple shading.
|
|
|
|
Simple Fresnel term approximation for metals. The metal is described by its (complex) refraction coefficient (nMetal,kMetal). |
|
Downsamples a face of a cube map. Downsamples the nFace-th face of a cube map from resolution CUBEMAP_SIZE to LR_CUBEMAP_SIZE by averaging the corresponding texel values. The EnvironmentMap is sampled via EnvironmentMapSampler.
|
|
See the pixel program.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Initial value: sampler_state { Texture = <Decoration>; MinFilter = LINEAR; MagFilter = LINEAR; AddressU = CLAMP; AddressV = CLAMP; } |
|
|
|
Initial value: sampler_state { Texture = <EnvironmentMap>; AddressU = WRAP; AddressV = WRAP; } |
|
current eye (camera) position
|
|
|
|
|
|
imaginary part of the refraction coefficient for metals
|
|
|
|
real part of the refraction coefficient for metals
|
|
|
|
|
|
Initial value: sampler_state { MinFilter = LINEAR; MagFilter = LINEAR; Texture = <PreconvolvedEnvironmentMap>; AddressU = WRAP; AddressV = WRAP; } |
|
Reference point for the last cube map generation.
|
|
|
|
Fresnel refraction param.
|
|
|
|
|
|
Initial value: sampler_state { MinFilter = Point; MagFilter = Point; Texture = <SmallEnvironmentMap>; AddressU = WRAP; AddressV = WRAP; } |
|
upload this constant every time the viewport changes
|
|
World matrix for the current object.
|
|
World matrix IT (inverse transposed) to transform surface normals of the current object.
|
|
World * View matrix.
|
|
World * View * Projection matrix.
|