Hi all,
first off, im using Cg on an ATI Radeon 9500 Cat 4.7 WinXP SP2.
the problem, it seems that the depth value for a fragment is
not being interpolated properly or something (this is not an
ATI driver bug, checked this with a 5900XT)
basically here is my CgVP
struct appdata {
float4 position : POSITION;
};
struct V2FI {
float4 pos: POSITION;
float2 tex0: TEXCOORD0;
float npos: TEXCOORD1;
};
V2FI main( appdata IN, uniform float4x4 matMVP ) {
V2FI OUT;
float4 p = mul( matMVP, IN.position );
OUT.pos = p;
OUT.npos = p.z;
OUT.tex0 = float2(0,0);
return OUT;
}
and all i do is get the interpolated Z value in my FP by
a simple
float depth = IN.pos.z
I've tried:
1. dividing the depth by IN.pos.w, nothing
2. tried hard coded values to see if the rest of the FP is working (it is.)
3. used some color debugging, eg. if depth value < x then fragment = blue else fragment = red, behaves incorrectly when rendering my scene, but is correct for hardcoded values.
Odd things:
1. if i use "depth = IN.npos" i get totaly different results (still incorrect though)
2. this should be a very simple task, i have no lighting or textures, just a sphere (which is called from a DL btw)
any pointers?
i'd be glad to provide more code if need be, but prefer not to.
Cheers,
Danu
PS. are there any Pixel Shader debuggers around (appart from NV-FXComposer)?