Graphics Reference
In-Depth Information
// 1) use a left-handed view/projection; OR
// 2) use a right-handed view/projection with -1 X-
// axis scale
// Our meshes assume a right-handed coordinate system
// therefore both cases above require vertex winding
// to be switched.
uint3 idx = uint3(0,2,1);
[unroll]
for (int v = 0; v < 3; v++)
{
// Apply cube face view/projection
output.Position =
mul(input[idx[v]].Position, viewProj);
// Copy other vertex properties as is
output.WorldPosition = input[idx[v]].WorldPosition;
...SNIP
// Append to the stream
stream.Append(output);
}
stream.RestartStrip();
}
To achieve the best geometry shader performance, it is critical
to try and minimize the amount of data passing in and out of
the stage. The PixelShaderInput structure used in our
recipes includes a number of additional properties for illustrative
purposes that should be removed when not needed.
7.
Add a new pixel shader for generating a cube map; this is a copy of our Blinn-Phong
pixel shader. There are three differences highlighted in the following snippet from
the original shader:
// Globals for texture sampling
Texture2D Texture0 : register(t0);
TextureCube Reflection : register(t1);
SamplerState Sampler : register(s0);
float4 PS_CubeMap(GS_CubeMapOutput pixel) : SV_Target
{
// Normalize our vectors
float3 normal = normalize(pixel.WorldNormal);
float3 toEye = normalize(pixel.ToCamera);
...SNIP
 
Search WWH ::




Custom Search