Recreating Depth Value

Started by
2 comments, last by Dawoodoz 12 years, 1 month ago
i am working on improving my gbuffer and rendering. currently, i recreate my position using the Inverse View Projection. this works fine. however, reading thru a tutorial, and trying to implement his method, i have run into a problem. my shades do not use D3D10_SHADER_PACK_MATRIX_ROW_MAJOR flag, which the tutorial does. so i am assuming the problem lies somewhere in that issue.

inside the shader code, are the following segments, and i am hoping someone can help me port these over so that ROW_MAJOR is not required.

Snippet One
float3 ComputePositionViewFromZ(float2 positionScreen, float viewSpaceZ) {
float2 screenSpaceRay = float2(positionScreen.x / cCameraProj._11, positionScreen.y / cCameraProj._22);

float3 positionView;
positionView.z = viewSpaceZ;
// Solve the two projection equations
positionView.xy = screenSpaceRay.xy * positionView.z;

return positionView;
}


Snippet Two
float viewSpaceZ = cCameraProj._43 / (zBuffer - cCameraProj._33);

Thanks much in advance
Code makes the man
Advertisement
To switch between row major and column major, just transpose the matrix.
That's what i thought, however, that is not working for me. must be something else.
Code makes the man
You can try reorganizing the constant buffers since they are my biggest source of unexpected behaviour.

This topic is closed to new replies.

Advertisement