ここで尋ねた質問を分割するように求められました。
1つの解決策が他の解決策を解決するのに役立つ可能性があるため、2つと3つの両方が同じ質問に当てはまると思いました. シェーダーをデバッグしようとしていますが、問題が発生しているようです。まず、分析モードを実行しているときに、Pix が大量のコードをスキップしているようです。これは、F12 キャプチャを使用し、D3DX 分析をオフにして実験を分析しています。XNAを使用しているため、オフにする必要があります。問題のシェーダー コードは次のとおりです。
float4 PixelShaderFunction(float2 OriginalUV : TEXCOORD0) : COLOR0
{
// Get the depth buffer value at this pixel.
float4 color = float4 (0, 0,0,0);
float4 finalColor = float4(0,0,0,0);
float zOverW = tex2D(mySampler, OriginalUV);
// H is the viewport position at this pixel in the range -1 to 1.
float4 H = float4(OriginalUV.x * 2 - 1, (1 - OriginalUV.y) * 2 - 1,
zOverW, 1);
// Transform by the view-projection inverse.
float4 D = mul(H, xViewProjectionInverseMatrix);
// Divide by w to get the world position.
float4 worldPos = D / D.w;
// Current viewport position
float4 currentPos = H;
// Use the world position, and transform by the previous view-
// projection matrix.
float4 previousPos = mul(worldPos, xPreviousViewProjectionMatrix);
// Convert to nonhomogeneous points [-1,1] by dividing by w.
previousPos /= previousPos.w;
// Use this frame's position and last frame's to compute the pixel
// velocity.
float2 velocity = (currentPos - previousPos)/2.f;
// Get the initial color at this pixel.
color = tex2D(sceneSampler, OriginalUV);
OriginalUV += velocity;
for(int i = 1; i < 1; ++i, OriginalUV += velocity)
{
// Sample the color buffer along the velocity vector.
float4 currentColor = tex2D(sceneSampler, OriginalUV);
// Add the current color to our color sum.
color += currentColor;
}
// Average all of the samples to get the final blur color.
finalColor = color / xNumSamples;
return finalColor;
}
キャプチャされたフレームでピクセルをデバッグすると、2 行しか動作していません。これらは color = tex2D(sceneSampler, OriginalUV) と finalColor = color / xNumSamples です。残りの Pix はスキップするか、スキップします。
また、Pix を使用してリアルタイムでデバッグできますか? この方法でより多くの情報が明らかになるかどうか疑問に思っています。
乾杯、