Graphics Reference
In-Depth Information
one reflective object to another requires us to perform the paraboloid projection on its
geometry, followed by sampling its own paraboloid maps to indicate what is visible on its
surface. In this way, reflections can bounce back and forth from one reflective object to
another. In the next section, we will discuss the implications of this effect, as well as how
to handle this from a scene level. For now, we will consider the shader programs used to
perform this rendering operation.
This configuration utilizes a vertex shader, a geometry shader, and a pixel shader,
shown in Listings 13.6, 13.7, and 13.8, respectively. The vertex shader is a direct com-
bination of the previous two techniques, performing the paraboloid projection in the first
portion of the shader and then calculating the needed world-space vectors for its own pa-
raboloid lookup in the latter portion of the shader.
struct VS_INPUT
{
float3 position : POSITION;
float3 normal
: NORMAL;
};
struct GS_INPUT
{ float4 position : SV_Position;
float
z_value
: ZVALUE;
float3 normal
: TEXCOORD0;
float3 eye
: TEXC00RD1;
};
struct PS_INPUT
{
float4 position : SV_Position;
float z_value : ZVALUE;
float3 normal : TEXCOORD0;
float3 eye : TEXC00RD1;
uint rtindex : SV_RenderTargetArrayIndex;
};
GS_INPUT VSMAIN( VS_INPUT IN )
{
GS_INPUT OUT;
// Transform the vertex to be relative to the paraboloid's basis.
OUT.position = mul( float4( IN.position, 1 ), WorldViewMatrix );
// Determine the distance between the paraboloid origin and the vertex,
float L = length ( OUT.position.xyz );
// Normalize the vector to the vertex
OUT.position = OUT.position / L;
// Save the z-component of the normalized vector
Search WWH ::




Custom Search