This is a discussion on camera space to screen space z component ... - Graphics ; Hi there, Consider this shader surface zdepth_test() { point Pc = transform("camera", P); point Ps = transform("screen", P); float s = 5.0; float e = 10.0; float z = zcomp(Pc); float w = zcomp(Ps); float a = e / ( ...
Hi there,
Consider this shader
surface zdepth_test()
{
point Pc = transform("camera", P);
point Ps = transform("screen", P);
float s = 5.0;
float e = 10.0;
float z = zcomp(Pc);
float w = zcomp(Ps);
float a = e / ( e - s );
float b = e * s / (s - e);
float c = a + b / z;
printf("%f:%f\n", c, w);
Ci = color Pn;
}
So what I am doing here is implementing what I think the conversion is
from camera space to screen space for the z component.
Now given that s and e are set to your near and far clipping planes
(as defined in the rib file "Clipping 5 10"), I would expect c and w
to come out as the same thing ... however they don't. They are pretty
close, but not exactly. It is almost as if the clipping planes being
used in renderman's own calculations are slighly different from those
defined.
Does anyone know why this is? I'm really curious to know!
Alex.